Show only started orders to members for ordering

This commit is contained in:
Patrick Gansterer 2020-02-25 00:38:06 +01:00
parent ab912877c3
commit 739914ad43
3 changed files with 5 additions and 3 deletions

View file

@ -27,6 +27,7 @@ class Order < ApplicationRecord
after_save :save_order_articles, :update_price_of_group_orders
# Finders
scope :started, -> { where('starts <= ?', Time.now) }
scope :open, -> { where(state: 'open').order('ends DESC') }
scope :finished, -> { where("orders.state = 'finished' OR orders.state = 'closed'").order('ends DESC') }
scope :finished_not_closed, -> { where(state: 'finished').order('ends DESC') }