Rcov C0 Coverage Information - RCov

app/models/submission_rule.rb

Name Total Lines Lines of Code Total Coverage Code Coverage
app/models/submission_rule.rb 95 57
96.84%
94.74%

Key

Code reported as executed by Ruby looks like this...and this: this line is also marked as covered.Lines considered as run by rcov, but not reported by Ruby, look like this,and this: these lines were inferred by rcov (using simple heuristics).Finally, here's a line marked as not executed.

Coverage Details

1 class SubmissionRule < ActiveRecord::Base
2 
3   belongs_to :assignment
4   has_many :periods, :dependent => :destroy, :order => 'id'
5   accepts_nested_attributes_for :periods, :allow_destroy => true
6 
7 #  validates_associated :assignment
8 #  validates_presence_of :assignment
9 
10   def can_collect_now?
11     return @can_collect_now if !@can_collect_now.nil?
12     @can_collect_now = Time.now >= get_collection_time
13   end
14 
15   # Cache that allows us to quickly get collection time
16   def get_collection_time
17     return @get_collection_time if !@get_collection_time.nil?
18     @get_collection_time = calculate_collection_time
19   end
20 
21   def calculate_collection_time
22     return assignment.latest_due_date + hours_sum.hours
23   end
24 
25   def calculate_grouping_collection_time(grouping)
26     if !grouping.inviter.section.nil?
27       return SectionDueDate.due_date_for(grouping.inviter.section,
28                                          assignment)
29     else
30       return assignment.due_date + hours_sum.hours
31     end
32   end
33 
34   # When Students commit code after the collection time, MarkUs should warn
35   # the Students with a message saying that the due date has passed, and the
36   # work they're submitting will probably not be graded
37   def commit_after_collection_message
38     #I18n.t 'submission_rules.submission_rule.commit_after_collection_message'
39     raise NotImplementedError.new("SubmissionRule:  commit_after_collection_message not implemented")
40   end
41 
42   # When Students view the File Manager after the collection time,
43   # MarkUs should warnthe Students with a message saying that the
44   # due date has passed, and that any work they're submitting will
45   # probably not be graded
46   def after_collection_message
47     raise NotImplementedError.new("SubmissionRule:  after_collection_message not implemented")
48   end
49 
50   # When we're past the due date, the File Manager for the students will display
51   # a message to tell them that they're currently past the due date.
52   def overtime_message
53     raise NotImplementedError.new("SubmissionRule: overtime_message not implemented")
54   end
55 
56   # Returns true or false based on whether the attached Assignment's properties
57   # will work with this particular SubmissionRule
58   def assignment_valid?
59     raise NotImplementedError.new("SubmissionRule: assignment_valid? not implemented")
60   end
61 
62   # Takes a Submission (with an attached Result), and based on the properties of
63   # this SubmissionRule, applies penalties to the Result - for example, will
64   # add an ExtraMark of a negative value, or perhaps add the use of a Grace Day.
65   def apply_submission_rule(submission)
66     raise NotImplementedError.new("SubmissionRule:  apply_submission_rule not implemented")
67   end
68 
69   def description_of_rule
70     raise NotImplementedError.new("SubmissionRule:  description_of_rule not implemented")
71   end
72 
73   def grader_tab_partial(grouping)
74     raise NotImplementedError.new("SubmissionRule:  render_grader_tab not implemented")
75   end
76 
77   def reset_collection_time
78     @get_collection_time = nil
79     @can_collect_now = nil
80   end
81 
82   private
83 
84   def calculate_overtime_hours_from(from_time)
85     overtime_hours = ((from_time - assignment.due_date) / 1.hour).ceil
86     # If the overtime is less than 0, that means it was submitted early, so
87     # just return 0 - otherwise, return overtime_hours.
88     return [0, overtime_hours].max
89   end
90 
91   def hours_sum
92     return 0
93   end
94 
95 end

Generated on Sun Feb 05 00:08:07 -0500 2012 with rcov 0.9.10