Class: Senkyoshi::GradeRangeCriteria
- Inherits:
-
GradeCriteria
- Object
- RuleCriteria
- GradeCriteria
- Senkyoshi::GradeRangeCriteria
- Defined in:
- lib/senkyoshi/models/grade_range_criteria.rb
Direct Known Subclasses
Constant Summary
Constants inherited from RuleCriteria
RuleCriteria::COMPLETION_TYPES
Constants included from Senkyoshi
DIR_BASE, FILE_BASE, MAIN_CANVAS_MODULE, MASTER_MODULE, PRE_RESOURCE_TYPE, RESOURCE_TYPE, VERSION
Instance Attribute Summary collapse
-
#min_score ⇒ Object
readonly
Returns the value of attribute min_score.
Attributes inherited from GradeCriteria
Attributes inherited from RuleCriteria
#asidata_id, #content_id, #id, #negated
Class Method Summary collapse
Instance Method Summary collapse
- #get_completion_type ⇒ Object
-
#initialize(id, outcome_def_id, negated, min_score) ⇒ GradeRangeCriteria
constructor
A new instance of GradeRangeCriteria.
- #make_completion(mod) ⇒ Object
Methods inherited from GradeCriteria
#canvas_conversion, #get_foreign_id, get_outcome_def_id, #set_foreign_ids
Methods inherited from RuleCriteria
#add_if_unique, #add_to_module_if_unique, #canvas_conversion, #get_id, get_id, get_negated, in_same_module?, #make_prereq, module_completion_requirement?, module_prerequisite?, #set_ids
Methods included from Senkyoshi
build_file, build_heirarchy, cleanup, configure, connect_content, create_canvas_course, create_random_hex, get_attribute_value, get_description, get_single_pre_data, get_text, initialize_course, iterate_files, iterate_xml, iterator_master, parse, parse_and_process_single, pre_iterator, read_file, reset, true?
Constructor Details
#initialize(id, outcome_def_id, negated, min_score) ⇒ GradeRangeCriteria
Returns a new instance of GradeRangeCriteria.
22 23 24 25 |
# File 'lib/senkyoshi/models/grade_range_criteria.rb', line 22 def initialize(id, outcome_def_id, negated, min_score) super(id, outcome_def_id, negated) @min_score = min_score end |
Instance Attribute Details
#min_score ⇒ Object (readonly)
Returns the value of attribute min_score.
20 21 22 |
# File 'lib/senkyoshi/models/grade_range_criteria.rb', line 20 def min_score @min_score end |
Class Method Details
.from_xml(xml) ⇒ Object
31 32 33 34 35 36 37 |
# File 'lib/senkyoshi/models/grade_range_criteria.rb', line 31 def self.from_xml(xml) id = RuleCriteria.get_id xml negated = Senkyoshi.true? RuleCriteria.get_negated xml outcome_def_id = GradeCriteria.get_outcome_def_id xml min_score = GradeRangePercentCriteria.get_min_score xml new(id, outcome_def_id, negated, min_score) end |
.get_min_score(xml) ⇒ Object
27 28 29 |
# File 'lib/senkyoshi/models/grade_range_criteria.rb', line 27 def self.get_min_score(xml) xml.xpath("./MIN_SCORE/@value").text end |
Instance Method Details
#get_completion_type ⇒ Object
39 40 41 |
# File 'lib/senkyoshi/models/grade_range_criteria.rb', line 39 def get_completion_type COMPLETION_TYPES[:min_score] end |
#make_completion(mod) ⇒ Object
43 44 45 46 47 |
# File 'lib/senkyoshi/models/grade_range_criteria.rb', line 43 def make_completion(mod) super(mod).tap do |completion_requirement| completion_requirement.min_score = @min_score end end |