def update
@attendance_record.assign_attributes(attendance_record_params)
if @attendance_record.attending.nil?
@attendance_record.destroy!
else
@attendance_record.save!
end => success
PatientStatusUpdater.call(patient: @patient)
if success
name = @patient.full_name
flash[:info] = if @attendance_record.attending?
t("attendance_flash.present", name:)
elsif @attendance_record.attending.nil?
t("attendance_flash.not_registered", name:)
else
t("attendance_flash.absent", name:)
end
programme = @session.programmes_for(patient: @patient).first
redirect_to session_patient_programme_path(@session, @patient, programme)
else
render :edit, status: :unprocessable_content
end
end