diff --git a/app/views/questions/_question.html.haml b/app/views/questions/_question.html.haml
index 54139208..bd39d530 100644
--- a/app/views/questions/_question.html.haml
+++ b/app/views/questions/_question.html.haml
@@ -49,6 +49,6 @@
%p.collapse{id: "raw-data#{question.id}"}
= aggregated_responses.responses.map(&:answer_index_with_reverse).join(', ')
- -# - if school_question.present?
- -# .clearfix
- -# %p= "Attempts: #{school_question.attempt_count}, Responses: #{school_question.response_count}, Response Rate: #{number_to_percentage(school_question.response_rate * 100, precision: 0)}"
+ - if school_question.present?
+ .clearfix
+ %p= "Attempts: #{school_question.attempt_count}, Responses: #{school_question.response_count}, Response Rate: #{number_to_percentage(school_question.response_rate * 100, precision: 0)}, Total: #{school_question.response_total}"
diff --git a/db/migrate/20181221180917_add_response_total_to_school_questions.rb b/db/migrate/20181221180917_add_response_total_to_school_questions.rb
new file mode 100644
index 00000000..10fd9567
--- /dev/null
+++ b/db/migrate/20181221180917_add_response_total_to_school_questions.rb
@@ -0,0 +1,5 @@
+class AddResponseTotalToSchoolQuestions < ActiveRecord::Migration[5.0]
+ def change
+ add_column :school_questions, :response_total, :integer
+ end
+end
diff --git a/lib/tasks/data.rake b/lib/tasks/data.rake
index c86ee39a..3240c93f 100644
--- a/lib/tasks/data.rake
+++ b/lib/tasks/data.rake
@@ -459,10 +459,10 @@ namespace :data do
category.questions.created_in(school_category.year).each do |question|
school = school_category.school
next if school.district.name != "Boston"
- attempt_count = Attempt.
+ attempts = Attempt.
created_in(school_category.year).
for_question(question).
- for_school(school).count
+ for_school(school)
available_responders = school.available_responders_for(question)
@@ -476,8 +476,11 @@ namespace :data do
school_category: school_category,
year: school_category.year,
attempt_count: available_responders,
- response_count: attempt_count,
- response_rate: attempt_count.to_f / available_responders.to_f
+ response_count: attempts.count,
+ response_rate: attempts.count.to_f / available_responders.to_f
+ response_total: attempts.sum do |a|
+ question.reverse? ? 6 - a.answer_index : a.answer_index
+ end
)
new_school_questions << school_question
school_questions << school_question