API v1 orders endpoints
This commit is contained in:
parent
7d5155bef6
commit
127ae83f04
9 changed files with 165 additions and 10 deletions
|
|
@ -51,6 +51,14 @@ class Order < ApplicationRecord
|
|||
include DateTimeAttributeValidate
|
||||
date_time_attribute :starts, :boxfill, :ends
|
||||
|
||||
def self.ransackable_attributes(auth_object = nil)
|
||||
%w(id state supplier_id starts boxfill ends pickup)
|
||||
end
|
||||
|
||||
def self.ransackable_associations(auth_object = nil)
|
||||
%w(supplier articles order_articles)
|
||||
end
|
||||
|
||||
def stockit?
|
||||
supplier_id.nil?
|
||||
end
|
||||
|
|
@ -111,11 +119,11 @@ class Order < ApplicationRecord
|
|||
end
|
||||
|
||||
def boxfill?
|
||||
FoodsoftConfig[:use_boxfill] && open? && boxfill.present? && boxfill < Time.now
|
||||
!!FoodsoftConfig[:use_boxfill] && open? && boxfill.present? && boxfill < Time.now
|
||||
end
|
||||
|
||||
def is_boxfill_useful?
|
||||
FoodsoftConfig[:use_boxfill] && supplier.try(:has_tolerance?)
|
||||
!!FoodsoftConfig[:use_boxfill] && !!supplier.try(:has_tolerance?)
|
||||
end
|
||||
|
||||
def expired?
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue