Class PenaltyPeriodSubmissionRule
In: app/models/penalty_period_submission_rule.rb
Parent: SubmissionRule

Methods

Public Instance methods

[Source]

    # File app/models/penalty_period_submission_rule.rb, line 14
14:   def after_collection_message(grouping)
15:     I18n.t 'submission_rules.penalty_period_submission_rule.after_collection_message'
16:   end

[Source]

    # File app/models/penalty_period_submission_rule.rb, line 35
35:   def apply_submission_rule(submission)
36:     # Calculate the appropriate penalty, and attach the ExtraMark to the
37:     # submission Result
38:     result = submission.result
39:     overtime_hours = calculate_overtime_hours_from(submission.revision_timestamp)
40:     penalty_amount = calculate_penalty(overtime_hours)
41:     penalty = ExtraMark.new
42:     penalty.result = result
43:     penalty.extra_mark = penalty_amount
44:     penalty.unit = ExtraMark::UNITS[:percentage]
45: 
46:     penalty.description = I18n.t 'submission_rules.penalty_period_submission_rule.extramark_description', :overtime_hours => overtime_hours, :penalty_amount => penalty_amount
47:     penalty.save
48:     
49:     return submission
50:   end

GracePeriodSubmissionRule works with all Assignments

[Source]

    # File app/models/penalty_period_submission_rule.rb, line 31
31:   def assignment_valid?
32:     return !assignment.nil?
33:   end

[Source]

   # File app/models/penalty_period_submission_rule.rb, line 3
3:   def calculate_collection_time
4:     return assignment.due_date + hours_sum.hours
5:   end

When Students commit code after the collection time, MarkUs should warn the Students with a message saying that the due date has passed, and the work they‘re submitting will probably not be graded

[Source]

    # File app/models/penalty_period_submission_rule.rb, line 10
10:   def commit_after_collection_message(grouping)
11:     I18n.t 'submission_rules.penalty_period_submission_rule.commit_after_collection_message'
12:   end

[Source]

    # File app/models/penalty_period_submission_rule.rb, line 52
52:   def description_of_rule
53:     I18n.t 'submission_rules.penalty_period_submission_rule.description'
54:   end

[Source]

    # File app/models/penalty_period_submission_rule.rb, line 56
56:   def grader_tab_partial
57:     return 'submission_rules/penalty_period/grader_tab'
58:   end

This message will be dislayed to Students on viewing their file manager after the due date has passed, but before the calculated collection date.

[Source]

    # File app/models/penalty_period_submission_rule.rb, line 20
20:   def overtime_message(grouping)
21:     # How far are we into overtime?
22:     overtime_hours = calculate_overtime_hours_from(Time.now)  
23:     # Calculate the penalty that the grouping will suffer
24:     potential_penalty = calculate_penalty(overtime_hours)
25: 
26:     return I18n.t 'submission_rules.penalty_period_submission_rule.overtime_message', :potential_penalty => potential_penalty
27:   end

[Validate]