Skip to content

Commit

Permalink
Closes #77
Browse files Browse the repository at this point in the history
All newly added TODOs supplemented by GitHub issue links
  • Loading branch information
lentschi committed Aug 2, 2024
1 parent bb044e6 commit cd2418c
Show file tree
Hide file tree
Showing 14 changed files with 11 additions and 41 deletions.
15 changes: 0 additions & 15 deletions HACKATHON_TODOS.md

This file was deleted.

4 changes: 1 addition & 3 deletions app/assets/javascripts/article-form.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,6 @@ class ArticleForm {
const relativePrice = this.price$.val();
const priceUnit = this.priceUnit$.val();
if (priceUnit === undefined) {
// TODO-article-version: StockArticles don't have a price unit?
return;
}
const ratio = this.getUnitRatio(1, priceUnit, this.supplierUnitSelect$.val());
Expand Down Expand Up @@ -484,7 +483,6 @@ class ArticleForm {
const supplierUnitPrice = this.price$.val();
const priceUnit = this.priceUnit$.val();
if (priceUnit === undefined) {
// TODO-article-version: StockArticles don't have a price unit?
return;
}
const ratio = this.getUnitRatio(1, priceUnit, this.supplierUnitSelect$.val());
Expand Down Expand Up @@ -587,7 +585,7 @@ class ArticleForm {
}


// TODO: Move those functions to some global js utils file:
// TODO: Move those functions to some global js utils file (see https://github.com/foodcoopsat/foodsoft_hackathon/issues/88):
function mergeJQueryObjects(array_of_jquery_objects) {
return $($.map(array_of_jquery_objects, function (el) {
return el.get();
Expand Down
2 changes: 1 addition & 1 deletion app/assets/javascripts/group-order-form.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class GroupOrderForm {
this.newBalance$.text(I18n.l('currency', balance));

// TODO: Figure out why this hidden field is required (Should be
// calculated in the controller IMO!):
// calculated in the controller IMO! - see https://github.com/foodcoopsat/foodsoft_hackathon/issues/97):
this.totalBalance$.val(I18n.l('currency', balance));

// determine bgcolor and submit button state according to balance
Expand Down
2 changes: 1 addition & 1 deletion app/helpers/suppliers_helper.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module SuppliersHelper
def shared_sync_method_collection
# TODO: See if we really need the import limit `shared_supplier_article_sync_limit`
# also see https://github.com/foodcoops/foodsoft/pull/609/files
# also see https://github.com/foodcoops/foodsoft/pull/609/files and https://github.com/foodcoopsat/foodsoft_hackathon/issues/89
Supplier.shared_sync_methods.keys.map do |m|
[t("suppliers.shared_supplier_methods.#{m}"), m]
end
Expand Down
8 changes: 4 additions & 4 deletions app/models/article.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class Article < ApplicationRecord

accepts_nested_attributes_for :latest_article_version

# TODO-article-version: Discuss if these delegates aren't actually a code smell:
# TODO: Remove these (see https://github.com/foodcoopsat/foodsoft_hackathon/issues/91):
begin
ArticleVersion.column_names.each do |column_name|
next if column_name == ArticleVersion.primary_key
Expand All @@ -92,12 +92,12 @@ class Article < ApplicationRecord
after_save :reload_article_on_version_change

def self.ransackable_attributes(_auth_object = nil)
# TODO-article-version
# TODO: - see https://github.com/foodcoopsat/foodsoft_hackathon/issues/92
%w[id name supplier_id article_category_id unit note manufacturer origin unit_quantity order_number]
end

def self.ransackable_associations(_auth_object = nil)
# TODO-article-version
# TODO: - see https://github.com/foodcoopsat/foodsoft_hackathon/issues/92
%w[article_category supplier order_articles orders]
end

Expand Down Expand Up @@ -182,7 +182,7 @@ def unequal_attributes(new_article, options = {})

if options[:convert_units] && latest_article_version.article_unit_ratios.length < 2 && new_article.article_unit_ratios.length < 2 && !new_unit_quantity.nil?
ret[:article_unit_ratios_attributes] = [new_article.article_unit_ratios.build(unit: 'XPP', quantity: new_unit_quantity, sort: 1).attributes]
# TODO: Either remove this aspect of the :convert_units feature or extend it to also work for the new units system
# TODO: Either remove this aspect of the :convert_units feature or extend it to also work for the new units system (see https://github.com/foodcoopsat/foodsoft_hackathon/issues/90)
end

ret
Expand Down
2 changes: 1 addition & 1 deletion app/models/article_version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def supplier_order_unit_is_si_convertible
ArticleUnitsLib.unit_is_si_convertible(supplier_order_unit)
end

# TODO: Maybe use the nilify blanks gem instead of the following six methods?:
# TODO: Maybe use the `nilify_blanks` gem instead of the following six methods? (see https://github.com/foodcoopsat/foodsoft_hackathon/issues/93):
def unit=(value)
if value.blank?
self[:unit] = nil
Expand Down
2 changes: 1 addition & 1 deletion app/models/supplier.rb
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def has_tolerance?
articles.with_latest_versions_and_categories.any? { |article| article.latest_article_version.uses_tolerance? }
end

# TODO: Maybe use the nilify blanks gem instead of the following two methods?:
# TODO: Maybe use the `nilify_blanks` gem instead of the following two methods? (see https://github.com/foodcoopsat/foodsoft_hackathon/issues/93):
def supplier_remote_source=(value)
if value.blank?
self[:supplier_remote_source] = nil
Expand Down
2 changes: 0 additions & 2 deletions config/locales/de.yml
Original file line number Diff line number Diff line change
Expand Up @@ -564,15 +564,13 @@ de:
prepare_units_migration:
title: Artikel von %{supplier} migrieren
explanation: |
TODO: Allgemeine Erklärung
Es wird sehr empfohlen ein Backup herunterzuladen ehe Sie fortfahren:
download: Artikel-Backup herunterladen
migrate_units: Nächster Schritt
migrate_units:
title: Artikel von %{supplier} migrieren
explanation: |
Die Artikeleinheiten werden nun in eine neue, flexiblere Form konvertiert. Passen Sie die Konvertierungsvorschläge an, ehe sie fortfahren.
TODO: Besser erklären; vielleicht mit Doku verlinken?
column_headers:
apply: Konvertieren
original_plaintext_unit: Ursprüngliche Volltext-Einheit
Expand Down
2 changes: 0 additions & 2 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -566,15 +566,13 @@ en:
upload: Upload articles
prepare_units_migration:
explanation: |
TODO: General explanation
It's highly recommended to download a backup before continuing:
title: Migrate articles of %{supplier}
download: Download articles backup
migrate_units:
title: Migrate articles of %{supplier}
explanation: |
This will try to migrate articles to their new, more versatile format. You may adapt the suggested changes before continuing if you see fit.
TODO: Expand on this explanation - maybe link to some docs
column_headers:
apply: Convert
original_plaintext_unit: Original plaintext unit
Expand Down
2 changes: 1 addition & 1 deletion config/puma.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,5 +57,5 @@
# Allow puma to be restarted by `rails restart` command.
plugin :tmp_restart

# TODO-no-upstream
# TODO: Check if we can leave that in there - see https://github.com/foodcoopsat/foodsoft_hackathon/issues/95:
worker_timeout 3600 if ENV.fetch('RAILS_ENV') == 'development'
2 changes: 1 addition & 1 deletion spec/factories/article_unit_ratio.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

FactoryBot.define do
factory :article_unit_ratio do
unit { 'XPP' } # TODO
unit { 'XPP' }
sort { 1 }
quantity { 1 }
article_version
Expand Down
3 changes: 0 additions & 3 deletions spec/integration/product_distribution_example_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,13 @@

find(".goa-quantity[data-e2e-order-article-id='#{oa.id}']").set '2'
find(".goa-tolerance[data-e2e-order-article-id='#{oa.id}']").set '3'
close_unit_conversion_popover
find('input[type=submit]').click
expect(page).to have_selector('body')
# gruppe b bestellt 2(0)
login user_b
visit new_group_order_path(order_id: order.id)
scrolldown
find(".goa-quantity[data-e2e-order-article-id='#{oa.id}']").set '2'
close_unit_conversion_popover
find('input[type=submit]').click
expect(page).to have_css('body')
# gruppe a faellt ein dass sie doch noch mehr braucht von x und aendert auf 4(1).
Expand All @@ -46,7 +44,6 @@
scrolldown
find(".goa-quantity[data-e2e-order-article-id='#{oa.id}']").set '4'
find(".goa-tolerance[data-e2e-order-article-id='#{oa.id}']").set '1'
close_unit_conversion_popover
find('input[type=submit]').click
expect(page).to have_css('body')
# die zuteilung
Expand Down
1 change: 0 additions & 1 deletion spec/integration/receive_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ def check_quantities(units, q1, q2)

def fill_units_field(order_article_id, with)
fill_in "order_articles_#{order_article_id}_units_received", with: with
close_unit_conversion_popover
end

before { login admin }
Expand Down
5 changes: 0 additions & 5 deletions spec/support/integration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,3 @@
def scrolldown
page.execute_script 'window.scrollBy(0,10000)'
end

def close_unit_conversion_popover
# TODO: Make unit conversion popover more user-friendly?
find('body > .logo').click
end

0 comments on commit cd2418c

Please sign in to comment.