Class: Moodle2CC::Moodle::Question

Inherits:
Object
  • Object
show all
Includes:
HappyMapper
Defined in:
lib/moodle2cc/moodle/question.rb

Defined Under Namespace

Classes: Answer, Calculation, Choice, Match, Numerical

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#gradeObject

Returns the value of attribute grade.



5
6
7
# File 'lib/moodle2cc/moodle/question.rb', line 5

def grade
  @grade
end

#instance_idObject

Returns the value of attribute instance_id.



5
6
7
# File 'lib/moodle2cc/moodle/question.rb', line 5

def instance_id
  @instance_id
end

#question_categoryObject

Returns the value of attribute question_category.



5
6
7
# File 'lib/moodle2cc/moodle/question.rb', line 5

def question_category
  @question_category
end

Instance Method Details

#instanceObject



90
91
92
93
94
95
96
97
98
# File 'lib/moodle2cc/moodle/question.rb', line 90

def instance
  question_category.course.mods.select do |mod|
    mod.mod_type == 'quiz'
  end.map do |mod|
    mod.question_instances.find do |qi|
      qi.question_id == id
    end
  end.compact.first
end