Skip to content

Instantly share code, notes, and snippets.

@sirramongabriel
Created December 18, 2019 18:53
Show Gist options
  • Save sirramongabriel/20aa8396882bfb34d0d60a0517deaf18 to your computer and use it in GitHub Desktop.
Save sirramongabriel/20aa8396882bfb34d0d60a0517deaf18 to your computer and use it in GitHub Desktop.
def sample_method
count = 0
med_name_count = 0
given_at_count = 0
# Ignore current_month var as it is for the histogram
# current_month = (Date.current.beginning_of_month..Date.current.end_of_month).to_a
@pdf = FillablePDF.new('app/pdfs/medication_record_form.pdf')
all_meds.each_slice(5) do |page|
page.map do |med|
count += 1
if med_name_count >= 5
med_name_count = 0
end
@pdfs["pdf_#{count}".to_sym] = @pdf.set_field("med#{med_name_count += 1}_name", med.name)
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment