fixing issue with reverse questions

pull/1/head
Jared Cosulich 8 years ago
parent 4f2e779dd0
commit 5ebb5de439

@ -67,7 +67,7 @@ class Attempt < ApplicationRecord
end
def answer_index_with_reverse
return 5 - answer_index if question.reverse?
return 6 - answer_index if question.reverse?
return answer_index
end

@ -19,7 +19,7 @@ class SchoolCategory < ApplicationRecord
for_school(school).
select('count(attempts.id) as attempt_count').
select('count(attempts.answer_index) as response_count').
select('sum(case when questions.reverse then 5 - attempts.answer_index else attempts.answer_index end) as answer_index_total')[0]
select('sum(case when questions.reverse then 6 - attempts.answer_index else attempts.answer_index end) as answer_index_total')[0]
return {
attempt_count: attempt_data.attempt_count || 0,

Loading…
Cancel
Save