Class: Senkyoshi::GradeRangePercentCriteria
- Inherits:
-
GradeRangeCriteria
- Object
- RuleCriteria
- GradeCriteria
- GradeRangeCriteria
- Senkyoshi::GradeRangePercentCriteria
- Defined in:
- lib/senkyoshi/models/grade_range_percent_criteria.rb
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
Attributes inherited from GradeRangeCriteria
Attributes inherited from GradeCriteria
Attributes inherited from RuleCriteria
#asidata_id, #content_id, #id, #negated
Class Method Summary collapse
Instance Method Summary collapse
- #canvas_conversion(course, content_id, resources) ⇒ Object
- #get_points_possible(resources, id) ⇒ Object
- #make_completion(mod) ⇒ Object
Methods inherited from GradeRangeCriteria
from_xml, #get_completion_type, get_min_score, #initialize
Methods inherited from GradeCriteria
from_xml, #get_foreign_id, get_outcome_def_id, #initialize, #set_foreign_ids
Methods inherited from RuleCriteria
#add_if_unique, #add_to_module_if_unique, from_xml, get_id, #get_id, get_negated, in_same_module?, #initialize, #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
This class inherits a constructor from Senkyoshi::GradeRangeCriteria
Class Method Details
.get_percentage(min_score, points_possible) ⇒ Object
32 33 34 |
# File 'lib/senkyoshi/models/grade_range_percent_criteria.rb', line 32 def self.get_percentage(min_score, points_possible) (min_score.to_f / 100) * points_possible.to_f end |
Instance Method Details
#canvas_conversion(course, content_id, resources) ⇒ Object
36 37 38 39 40 41 |
# File 'lib/senkyoshi/models/grade_range_percent_criteria.rb', line 36 def canvas_conversion(course, content_id, resources) set_foreign_ids(resources, @outcome_def_id) @points_possible = get_points_possible(resources, get_foreign_id) super(course, content_id, resources) end |
#get_points_possible(resources, id) ⇒ Object
27 28 29 30 |
# File 'lib/senkyoshi/models/grade_range_percent_criteria.rb', line 27 def get_points_possible(resources, id) resource = resources.find_by_id(id) resource.points_possible if resource end |
#make_completion(mod) ⇒ Object
20 21 22 23 24 25 |
# File 'lib/senkyoshi/models/grade_range_percent_criteria.rb', line 20 def make_completion(mod) super(mod).tap do |completion_requirement| completion_requirement.min_score = GradeRangePercentCriteria. get_percentage(@min_score, @points_possible) end end |