class SubmissionRule

Public Instance Methods

after_collection_message() click to toggle source

When Students view the File Manager after the collection time, MarkUs should warnthe Students with a message saying that the due date has passed, and that any work they’re submitting will probably not be graded

# File app/models/submission_rule.rb, line 50
def after_collection_message
  raise NotImplementedError.new('SubmissionRule:  after_collection_message not implemented')
end
apply_submission_rule(submission) click to toggle source

Takes a Submission (with an attached Result), and based on the properties of this SubmissionRule, applies penalties to the Result - for example, will add an ExtraMark of a negative value, or perhaps add the use of a Grace Day.

# File app/models/submission_rule.rb, line 69
def apply_submission_rule(submission)
  raise NotImplementedError.new('SubmissionRule:  apply_submission_rule not implemented')
end
assignment_valid?() click to toggle source

Returns true or false based on whether the attached Assignment’s properties will work with this particular SubmissionRule

# File app/models/submission_rule.rb, line 62
def assignment_valid?
  raise NotImplementedError.new('SubmissionRule: assignment_valid? not implemented')
end
calculate_collection_time() click to toggle source
# File app/models/submission_rule.rb, line 25
def calculate_collection_time
  assignment.latest_due_date + hours_sum.hours
end
calculate_grouping_collection_time(grouping) click to toggle source
# File app/models/submission_rule.rb, line 29
def calculate_grouping_collection_time(grouping)
  if grouping.inviter.section
    SectionDueDate.due_date_for(grouping.inviter.section,
                                       assignment)
  else
    assignment.due_date + hours_sum.hours
  end
end
can_collect_grouping_now?(grouping) click to toggle source
# File app/models/submission_rule.rb, line 15
def can_collect_grouping_now?(grouping)
  Time.zone.now >= calculate_grouping_collection_time(grouping)
end
can_collect_now?() click to toggle source

validates_associated :assignment validates_presence_of :assignment

# File app/models/submission_rule.rb, line 10
def can_collect_now?
  return @can_collect_now if !@can_collect_now.nil?
  @can_collect_now = Time.zone.now >= get_collection_time
end
commit_after_collection_message() click to toggle source

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

# File app/models/submission_rule.rb, line 41
def commit_after_collection_message
  #I18n.t 'submission_rules.submission_rule.commit_after_collection_message'
  raise NotImplementedError.new('SubmissionRule:  commit_after_collection_message not implemented')
end
description_of_rule() click to toggle source
# File app/models/submission_rule.rb, line 73
def description_of_rule
  raise NotImplementedError.new('SubmissionRule:  description_of_rule not implemented')
end
get_collection_time() click to toggle source

Cache that allows us to quickly get collection time

# File app/models/submission_rule.rb, line 20
def get_collection_time
  return @get_collection_time if !@get_collection_time.nil?
  @get_collection_time = calculate_collection_time
end
grader_tab_partial(grouping) click to toggle source
# File app/models/submission_rule.rb, line 77
def grader_tab_partial(grouping)
  raise NotImplementedError.new('SubmissionRule:  render_grader_tab not implemented')
end
overtime_message() click to toggle source

When we’re past the due date, the File Manager for the students will display a message to tell them that they’re currently past the due date.

# File app/models/submission_rule.rb, line 56
def overtime_message
  raise NotImplementedError.new('SubmissionRule: overtime_message not implemented')
end
reset_collection_time() click to toggle source
# File app/models/submission_rule.rb, line 81
def reset_collection_time
  @get_collection_time = nil
  @can_collect_now = nil
end