show articles ordered by members but not by foodcoop dimmed in receive

This commit is contained in:
wvengen 2014-08-29 12:23:23 +02:00
parent 790a6b1972
commit 8913ad615c
3 changed files with 7 additions and 2 deletions

View file

@ -12,7 +12,7 @@ class OrderArticle < ActiveRecord::Base
validate :article_and_price_exist
validates_uniqueness_of :article_id, scope: :order_id
_ordered_sql = "units_to_order > 0 OR units_billed > 0 OR units_received > 0"
_ordered_sql = "units_to_order > 0 OR units_billed > 0 OR units_received > 0 OR order_articles.quantity > 0"
scope :ordered, -> { where(_ordered_sql) }
scope :ordered_or_member, -> { includes(:group_order_articles).where("#{_ordered_sql} OR group_order_articles.result > 0") }