Class: ExamRegistration::AuthorizationCriterion::PassedExercises

Inherits:
ExamRegistration::AuthorizationCriterion show all
Defined in:
app/models/exam_registration/authorization_criterion.rb

Instance Attribute Summary

Attributes inherited from ExamRegistration::AuthorizationCriterion

#value

Instance Method Summary collapse

Methods inherited from ExamRegistration::AuthorizationCriterion

#as_json, #authorization_criteria_matcher, #authorization_status_for, #ensure_valid!, #initialize, #meets_authorization_criteria?, parse, parse_criterion_type, #process_request!, #type

Constructor Details

This class inherits a constructor from ExamRegistration::AuthorizationCriterion

Instance Method Details

#criterion_matcherObject



74
75
76
# File 'app/models/exam_registration/authorization_criterion.rb', line 74

def criterion_matcher
  { 'stats.passed': { '$gte': value.to_f } }
end

#meets_criterion?(user, organization) ⇒ Boolean

Returns:

  • (Boolean)


70
71
72
# File 'app/models/exam_registration/authorization_criterion.rb', line 70

def meets_criterion?(user, organization)
  user.passed_submissions_count_in(organization) >= value
end

#valid?Boolean

Returns:

  • (Boolean)


66
67
68
# File 'app/models/exam_registration/authorization_criterion.rb', line 66

def valid?
  value.positive?
end