@@ -41,6 +41,7 @@ def wizard_steps
4141 ( :outcome if can_change_outcome? ) ,
4242 ( :delivery if administered? ) ,
4343 ( :batch if administered? ) ,
44+ ( :dose if administered? && can_be_half_dose? ) ,
4445 ( :location if location &.generic_clinic? ) ,
4546 :confirm
4647 ] . compact
@@ -73,6 +74,10 @@ def wizard_steps
7374 validates :batch_id , presence : true
7475 end
7576
77+ on_wizard_step :dose , exact : true do
78+ validates :full_dose , inclusion : [ true , false ]
79+ end
80+
7681 on_wizard_step :location , exact : true do
7782 validates :location_name , presence : true
7883 end
@@ -175,6 +180,7 @@ def vaccination_record=(value)
175180 end
176181
177182 delegate :vaccine , to : :batch , allow_nil : true
183+ delegate :can_be_half_dose? , to : :vaccine , allow_nil : true
178184
179185 delegate :id , to : :vaccine , prefix : true , allow_nil : true
180186
@@ -187,10 +193,13 @@ def writable_attribute_names
187193 end
188194
189195 def reset_unused_fields
190- unless administered?
196+ if administered?
197+ self . full_dose = true unless can_be_half_dose?
198+ else
191199 self . batch_id = nil
192200 self . delivery_method = nil
193201 self . delivery_site = nil
202+ self . full_dose = nil
194203 end
195204 end
196205
0 commit comments