Skip to content

Commit

Permalink
module progression cleanup
Browse files Browse the repository at this point in the history
test plan:
 * automated tests pass

Change-Id: I03dab9e13968c49387a2956c1c827d12792883f2
Reviewed-on: https://gerrit.instructure.com/31255
Tested-by: Jenkins <[email protected]>
Reviewed-by: Simon Williams <[email protected]>
Product-Review: Mark Severson <[email protected]>
QA-Review: Mark Severson <[email protected]>
  • Loading branch information
miquella committed Apr 2, 2014
1 parent 8b6b9f7 commit 73f552e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions app/models/context_module_progression.rb
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def requirement_met(req, is_met)
requirements_met << req
end

def other_requirement_met?(req)
def any_requirement_met?(req)
met = requirements_met.any? {|r| r[:id] == req[:id] }
@started = true if met
met
Expand All @@ -108,7 +108,7 @@ def view_requirement(req)

def check_view_requirements
view_requirements.each do |req|
requirement_met(req, other_requirement_met?(req))
requirement_met(req, any_requirement_met?(req))
end
end
end
Expand Down Expand Up @@ -182,9 +182,9 @@ def get_submission_score(tag)
def evaluate_score_requirement_met(requirement, tag)
score = get_submission_score(tag)
if requirement[:type] == "max_score"
!!score && score <= requirement[:max_score].to_f
score.present? && score <= requirement[:max_score].to_f
else
!!score && score >= requirement[:min_score].to_f
score.present? && score >= requirement[:min_score].to_f
end
end
private :evaluate_score_requirement_met
Expand Down
2 changes: 1 addition & 1 deletion spec/models/context_module_progression_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
ContextModuleProgression.prerequisites_satisfied?(@user, @module3).should == true
end

it "should be satisfied if dependant on both a published and unpublished module" do
it "should be satisfied if dependent on both a published and unpublished module" do
@module3.prerequisites = "module_#{@module.id}"
@module3.prerequisites = [{:type=>"context_module", :id=>@module.id, :name=>@module.name}, {:type=>"context_module", :id=>@module2.id, :name=>@module2.name}]
@module3.save!
Expand Down

0 comments on commit 73f552e

Please sign in to comment.