app/models/reserve.rb in enju_circulation-0.2.0.beta.3 vs app/models/reserve.rb in enju_circulation-0.2.0.beta.4

- old
+ new

@@ -1,9 +1,9 @@ class Reserve < ActiveRecord::Base include Statesman::Adapters::ActiveRecordQueries scope :hold, -> { where('item_id IS NOT NULL') } scope :not_hold, -> { where(item_id: nil) } - scope :waiting, -> {not_in_state(:completed, :expired).where('canceled_at IS NULL AND (expired_at > ? OR expired_at IS NULL)', Time.zone.now).order('reserves.id DESC')} + scope :waiting, -> {not_in_state(:completed, :expired, :retained).where('canceled_at IS NULL AND (expired_at > ? OR expired_at IS NULL)', Time.zone.now).order('reserves.id DESC')} scope :retained, -> {in_state(:retained).where('retained_at IS NOT NULL')} scope :completed, -> {in_state(:completed).where('checked_out_at IS NOT NULL')} scope :canceled, -> {in_state(:canceled).where('canceled_at IS NOT NULL')} scope :postponed, -> {in_state(:postponed).where('postponed_at IS NOT NULL')} scope :will_expire_retained, lambda {|datetime| in_state(:retained).where('checked_out_at IS NULL AND canceled_at IS NULL AND expired_at <= ?', datetime).order('expired_at')}