+++ /dev/null
-<%=
-render_pdf do |pdf|
- pdf.repeat(:all) do
- pdf.text "解答レポート #{Time.now.strftime('%Y-%m-%d %H:%M:%S')}", :at => [pdf.bounds.right-200, pdf.bounds.top]
- end
- data = @reports.map{|report|
- [report.created_at.to_date.to_s, report.problem_group.label, report.summary]
- }
- sum = @reports.inject([0, 0]){|memo, r| a, b = r.summary.split('/'); [memo.first + a.to_i, memo.last + b.to_i] }
- data << ["", "合計", "#{sum.first}/#{sum.last}"]
- pdf.move_down 10
- pdf.column_box([0, 750], :columns => 2, :spacer => 3, :width => pdf.bounds.width, :height => 700) do
- pdf.table(data,
- :position => :left,
- :headers => ["回答日", "ラベル", "正答率"],
- :border_style => :grid,
- :vertical_padding => 5,
- :horizontal_padding => 3)
- end
- pdf.number_pages "<page> / <total>", [pdf.bounds.right - 50, 0]
-end
-%>
+++ /dev/null
-<%=
-render_pdf do |pdf|
- pdf.repeat(:all) do
- pdf.text "解答レポート #{Time.now.strftime('%Y-%m-%d %H:%M:%S')}", :at => [pdf.bounds.right-200, pdf.bounds.top]
- end
- pdf.text "単元 : " + @report.problem_group.label
- pdf.text "問題 : " + @report.problem_group.description
- pdf.move_down 10
- data = []
- @results.each.with_index do |result, index|
- data << [index+1, result.problem_expression, result.answer, result.example_solution, judgement(result.correct?)]
- end
- pdf.table(data,
- :position => :center,
- :headers => [" ", "問題", "あなたの答え", "正しい答え", "判定"],
- :border_style => :grid,
- :vertical_padding => 5,
- :horizontal_padding => 3)
-end
-%>
-