show lines with zero units but with member orders in balancing screen (closes foodcoops/foodsoft#179)

This commit is contained in:
wvengen 2013-10-02 16:32:29 +02:00
parent 9ac9d1ea50
commit 6cfaa4979a
2 changed files with 3 additions and 2 deletions

View file

@ -12,7 +12,8 @@ class OrderArticle < ActiveRecord::Base
validate :article_and_price_exist
validates_uniqueness_of :article_id, scope: :order_id
scope :ordered, :conditions => "units_to_order >= 1"
scope :ordered, :conditions => "units_to_order > 0"
scope :ordered_or_member, -> { includes(:group_order_articles).where("units_to_order > 0 OR group_order_articles.result > 0") }
before_create :init_from_balancing
after_destroy :update_ordergroup_prices