27
27
# fk_rails_... (imported_from_id => immunisation_imports.id)
28
28
#
29
29
class Session < ApplicationRecord
30
+ include Draftable
30
31
include WizardStepConcern
32
+
31
33
audited
32
34
33
35
DEFAULT_DAYS_FOR_REMINDER = 2
@@ -46,20 +48,14 @@ class Session < ApplicationRecord
46
48
47
49
enum :time_of_day , %w[ morning afternoon all_day ]
48
50
49
- scope :active , -> { where ( active : true ) }
50
- scope :draft , -> { where ( active : false ) }
51
51
scope :past , -> { where ( date : ..Time . zone . yesterday ) }
52
52
scope :in_progress , -> { where ( date : Time . zone . today ) }
53
53
scope :future , -> { where ( date : Time . zone . tomorrow ..) }
54
54
55
55
after_initialize :set_timeline_attributes
56
56
after_validation :set_timeline_timestamps
57
57
58
- validates :time_of_day ,
59
- inclusion : {
60
- in : time_of_days . keys
61
- } ,
62
- unless : -> { draft? }
58
+ validates :time_of_day , inclusion : { in : time_of_days . keys } , unless : :draft?
63
59
64
60
on_wizard_step :location , exact : true do
65
61
validates :location_id , presence : true
@@ -98,10 +94,6 @@ class Session < ApplicationRecord
98
94
if : -> { close_consent_on == "custom" }
99
95
end
100
96
101
- def draft?
102
- !active
103
- end
104
-
105
97
def health_questions
106
98
campaign . vaccines . first . health_questions
107
99
end
0 commit comments