Show only started orders to members for ordering
This commit is contained in:
parent
ab912877c3
commit
739914ad43
3 changed files with 5 additions and 3 deletions
|
@ -27,6 +27,7 @@ class Order < ApplicationRecord
|
||||||
after_save :save_order_articles, :update_price_of_group_orders
|
after_save :save_order_articles, :update_price_of_group_orders
|
||||||
|
|
||||||
# Finders
|
# Finders
|
||||||
|
scope :started, -> { where('starts <= ?', Time.now) }
|
||||||
scope :open, -> { where(state: 'open').order('ends DESC') }
|
scope :open, -> { where(state: 'open').order('ends DESC') }
|
||||||
scope :finished, -> { where("orders.state = 'finished' OR orders.state = 'closed'").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') }
|
scope :finished_not_closed, -> { where(state: 'finished').order('ends DESC') }
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
- orders = Order.open.reject{ |order| order == current_order }
|
- orders = Order.open.started.reject{ |order| order == current_order }
|
||||||
- unless orders.empty?
|
- unless orders.empty?
|
||||||
%h2= t '.title'
|
%h2= t '.title'
|
||||||
%ul.unstyled
|
%ul.unstyled
|
||||||
|
|
|
@ -3,7 +3,8 @@
|
||||||
- if ordergroup.not_enough_apples?
|
- if ordergroup.not_enough_apples?
|
||||||
.alert
|
.alert
|
||||||
= t '.not_enough_apples'
|
= t '.not_enough_apples'
|
||||||
- unless Order.open.empty?
|
- orders = Order.open.started
|
||||||
|
- unless orders.empty?
|
||||||
%table.table.table-striped
|
%table.table.table-striped
|
||||||
%thead
|
%thead
|
||||||
%tr
|
%tr
|
||||||
|
@ -14,7 +15,7 @@
|
||||||
%th.numeric= heading_helper GroupOrder, :price
|
%th.numeric= heading_helper GroupOrder, :price
|
||||||
%tbody
|
%tbody
|
||||||
- total = 0
|
- total = 0
|
||||||
- Order.open.each do |order|
|
- orders.each do |order|
|
||||||
%tr
|
%tr
|
||||||
%td= link_to_ordering(order)
|
%td= link_to_ordering(order)
|
||||||
%td= format_date(order.pickup) unless order.pickup.nil?
|
%td= format_date(order.pickup) unless order.pickup.nil?
|
||||||
|
|
Loading…
Reference in a new issue