Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Template variables in tables (which in turn are placed within sections) are not replaced #11

Closed
tztz opened this Issue · 1 comment

2 participants

Mark von Zeschau Sandro Duarte
Mark von Zeschau

Hallo again,

after I've updated to your new version with nested sections support, report generating does not work anymore: all template variables in tables are not replaced with their resp. content. I don't know yet whether or not this has something to do with the fact that these tables are placed in sections.

Here's my code:

  def self.render_sections(r, section_reports)
    list_item_bullet = 1
    #is_first_section = true

    section_reports_to_render = section_reports.reject { |section_report| section_report.corrective_actions.empty? && !section_report.contains_visible_questions }
    @rendered_sections = section_reports_to_render

    r.add_section("sections", section_reports_to_render) do |s|
      #pdf.start_new_page unless is_first_section
      #is_first_section = false

      # Section title
      s.add_field(:section_title, :section_title)

      # Section classification (only if there are corrective actions)
      s.add_field(:question_classification) do |sr|
        if !sr.corrective_actions.empty?
          question_classifications = Report::SectionReport.filter_classifications(sr.question_classifications)
          question_classifications.keys.join(', ')
        end
      end

      # Corrective actions
      s.add_table(:corrective_actions, :corrective_actions, :skip_empty_rows => true) do |t|
        t.add_column(:corrective_action_string) do |ca|
          str = "#{list_item_bullet}. #{ca}"
          list_item_bullet += 1
          str
        end
      end

      # not important for now ### render_visible_questions(s)

    end
  end

Regards,
Mark

Sandro Duarte
Owner

Could you please try again with the 0.4.3 version?

Sandro Duarte sandrods closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.