| Name | Total Lines | Lines of Code | Total Coverage | Code Coverage |
|---|---|---|---|---|
| app/models/submission_rule.rb | 81 | 45 | 95.06%
|
91.11%
|
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.
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 # Based on the assignment's due date, return the collection time for submissions |
22 # Return a value of type Time |
23 def calculate_collection_time |
24 raise NotImplementedError.new("SubmissionRule: calculate_collection_time not implemented") |
25 end |
26 |
27 # When Students commit code after the collection time, MarkUs should warn |
28 # the Students with a message saying that the due date has passed, and the |
29 # work they're submitting will probably not be graded |
30 def commit_after_collection_message |
31 #I18n.t 'submission_rules.submission_rule.commit_after_collection_message' |
32 raise NotImplementedError.new("SubmissionRule: commit_after_collection_message not implemented") |
33 end |
34 |
35 # When Students view the File Manager after the collection time, |
36 # MarkUs should warnthe Students with a message saying that the |
37 # due date has passed, and that any work they're submitting will |
38 # probably not be graded |
39 def after_collection_message |
40 raise NotImplementedError.new("SubmissionRule: after_collection_message not implemented") |
41 end |
42 |
43 # When we're past the due date, the File Manager for the students will display |
44 # a message to tell them that they're currently past the due date. |
45 def overtime_message |
46 raise NotImplementedError.new("SubmissionRule: overtime_message not implemented") |
47 end |
48 |
49 # Returns true or false based on whether the attached Assignment's properties |
50 # will work with this particular SubmissionRule |
51 def assignment_valid? |
52 raise NotImplementedError.new("SubmissionRule: assignment_valid? not implemented") |
53 end |
54 |
55 # Takes a Submission (with an attached Result), and based on the properties of |
56 # this SubmissionRule, applies penalties to the Result - for example, will |
57 # add an ExtraMark of a negative value, or perhaps add the use of a Grace Day. |
58 def apply_submission_rule(submission) |
59 raise NotImplementedError.new("SubmissionRule: apply_submission_rule not implemented") |
60 end |
61 |
62 def description_of_rule |
63 raise NotImplementedError.new("SubmissionRule: description_of_rule not implemented") |
64 end |
65 |
66 def grader_tab_partial(grouping) |
67 raise NotImplementedError.new("SubmissionRule: render_grader_tab not implemented") |
68 end |
69 |
70 def reset_collection_time |
71 @get_collection_time = nil |
72 @can_collect_now = nil |
73 end |
74 |
75 private |
76 |
77 def calculate_overtime_hours_from(from_time) |
78 return ((from_time - assignment.due_date) / 1.hour).ceil |
79 end |
80 |
81 end |
Generated on Thu Sep 09 00:10:35 -0400 2010 with rcov 0.9.8