mirror of
https://github.com/edcommonwealth/sqm-dashboards.git
synced 2026-03-07 21:48:16 -08:00
fixing issue with reverse questions
This commit is contained in:
parent
4f2e779dd0
commit
5ebb5de439
2 changed files with 2 additions and 2 deletions
|
|
@ -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…
Add table
Add a link
Reference in a new issue