From 5ebb5de439cf405911a72f6a813aa59d258a04cd Mon Sep 17 00:00:00 2001 From: Jared Cosulich Date: Fri, 8 Dec 2017 09:08:12 -0500 Subject: [PATCH] fixing issue with reverse questions --- app/models/attempt.rb | 2 +- app/models/school_category.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/attempt.rb b/app/models/attempt.rb index aceb58b2..8a837a50 100644 --- a/app/models/attempt.rb +++ b/app/models/attempt.rb @@ -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 diff --git a/app/models/school_category.rb b/app/models/school_category.rb index 3d4bb68a..330fad4d 100644 --- a/app/models/school_category.rb +++ b/app/models/school_category.rb @@ -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,