Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Solved for the moment, rather crude--as is my current ruby skill set--but it seems to have done the job. </p> <pre><code> @appointment = Appointment.new(params[:appointment]) set_variables @appointment.save if @procedure.occurence == "BIWEEKLY" @visits = @procedure.visits - 1 @visits.times do |n| procedure_id = @appointment.procedure_id patient_id = @appointment.patient_id appointment_date = (@appointment.appointment_date + ((n+2)*2).days).to_formatted_s(:db) appointment_time = @appointment.appointment_time appointment_notes = @appointment.appointment_notes attendance = "SCHEDULED" @scheduled = Appointment.create(procedure_id: procedure_id, patient_id: patient_id, appointment_date: appointment_date, appointment_time: appointment_time, appointment_notes: appointment_notes, attendance: attendance) end end if @procedure.occurence == "WEEKLY" @visits = @procedure.visits - 1 @visits.times do |n| procedure_id = @appointment.procedure_id patient_id = @appointment.patient_id appointment_date = (@appointment.appointment_date + (n+1).week).to_formatted_s(:db) appointment_time = @appointment.appointment_time appointment_notes = @appointment.appointment_notes attendance = "SCHEDULED" @scheduled = Appointment.create(procedure_id: procedure_id, patient_id: patient_id, appointment_date: appointment_date, appointment_time: appointment_time, appointment_notes: appointment_notes, attendance: attendance) end end if @procedure.occurence == "MONTHLY" @visits = @procedure.visits - 1 @visits.times do |n| procedure_id = @appointment.procedure_id patient_id = @appointment.patient_id appointment_date = (@appointment.appointment_date + (n+1).month).to_formatted_s(:db) appointment_time = @appointment.appointment_time appointment_notes = @appointment.appointment_notes attendance = "SCHEDULED" @scheduled = Appointment.create(procedure_id: procedure_id, patient_id: patient_id, appointment_date: appointment_date, appointment_time: appointment_time, appointment_notes: appointment_notes, attendance: attendance) end end </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload