Add option to ignore delivered amounts in order group distribution (#765)
This commit is contained in:
parent
ecda1c1478
commit
45a8911ca6
11 changed files with 69 additions and 4 deletions
|
|
@ -128,15 +128,18 @@ class GroupOrderArticle < ApplicationRecord
|
|||
order_quantities = GroupOrderArticleQuantity.where(group_order_article_id: order_article.group_order_article_ids).order('created_on')
|
||||
logger.debug "GroupOrderArticleQuantity records found: #{order_quantities.size}"
|
||||
|
||||
first_order_first_serve = (FoodsoftConfig[:distribution_strategy] == FoodsoftConfig::DistributionStrategy::FIRST_ORDER_FIRST_SERVE)
|
||||
|
||||
# Determine quantities to be ordered...
|
||||
order_quantities.each do |goaq|
|
||||
q = [goaq.quantity, total - total_quantity].min
|
||||
q = goaq.quantity
|
||||
q = [q, total - total_quantity].min if first_order_first_serve
|
||||
total_quantity += q
|
||||
if goaq.group_order_article_id == self.id
|
||||
logger.debug "increasing quantity by #{q}"
|
||||
quantity += q
|
||||
end
|
||||
break if total_quantity >= total
|
||||
break if total_quantity >= total && first_order_first_serve
|
||||
end
|
||||
|
||||
# Determine tolerance to be ordered...
|
||||
|
|
|
|||
|
|
@ -1,11 +1,10 @@
|
|||
class ConfigSerializer < ActiveModel::Serializer
|
||||
|
||||
# details
|
||||
attributes :name, :homepage, :contact
|
||||
|
||||
# settings
|
||||
attributes :currency_unit, :currency_space, :default_locale, :price_markup,
|
||||
:tolerance_is_costly, :use_apple_points, :use_tolerance
|
||||
:tolerance_is_costly, :distribution_strategy, :use_apple_points, :use_tolerance
|
||||
|
||||
# layout
|
||||
attributes :page_footer_html, :webstats_tracking_code_html
|
||||
|
|
|
|||
|
|
@ -1,5 +1,8 @@
|
|||
= config_input form, :use_nick, as: :boolean
|
||||
= config_input form, :tolerance_is_costly, as: :boolean
|
||||
- distribution_strategy_options = FoodsoftConfig::DistributionStrategy.constants.map { |c| FoodsoftConfig::DistributionStrategy.const_get(c) }
|
||||
= config_input form, :distribution_strategy, as: :select, collection: distribution_strategy_options,
|
||||
include_blank: false, input_html: {class: 'input-xxlarge'}, label_method: ->(s){ t("config.keys.distribution_strategy_options.#{s}") }
|
||||
= config_input form, :disable_invite, as: :boolean
|
||||
= config_input form, :help_url, as: :url, input_html: {class: 'input-xlarge'}
|
||||
= config_input form, :webstats_tracking_code, as: :text, input_html: {class: 'input-xxlarge', rows: 3}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue