Skip to content

Commit

Permalink
Reimplemented quiz_questionnaire.rb (expertiza#117)
Browse files Browse the repository at this point in the history
* Reimplemented quiz_questionnaire.rb

* Update quiz_questionnaire.rb

---------

Co-authored-by: Ameya Vaichalkar <[email protected]>
  • Loading branch information
mithila-reddy and ameyagv authored Oct 16, 2024
1 parent fdf2a81 commit 11faa07
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions app/models/quiz_questionnaire.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
class QuizQuestionnaire < Questionnaire
attr_accessor :questionnaire
after_initialize :post_initialization

def post_initialization
self.display_type = 'Quiz'
end

def symbol
'quiz'.to_sym
end

def get_assessments_for(participant)
participant.quizzes_taken
end

def taken_by_anyone?
!ResponseMap.where(reviewed_object_id: id, type: 'QuizResponseMap').empty?
end

def taken_by?(participant)
!ResponseMap.where(reviewed_object_id: id, type: 'QuizResponseMap', reviewer_id: participant.id).empty?
end
end

0 comments on commit 11faa07

Please sign in to comment.