app/models/mark.rb
# When a mark is saved, we need to make sure that that
# Result has not been released to students
When a mark is saved, we need to make sure that that
Result has not been released to students
When a mark is saved we need to make sure that that Result has not been released to students
def update_deduction
    if self.mark.nil? && deductive_annotations_absent?
      return self.update!(override: false)
    end
    return if self.override?
    deduction = calculate_deduction
    if deduction == 0
      self.update!(mark: nil)
    elsif deduction > self.criterion.max_mark
      self.update!(mark: 0.0)
    else
      self.update!(mark: self.criterion.max_mark - deduction)
    end
  end
def update_deduction if self . mark . nil? && deductive_annotations_absent? return self . update! ( override : false ) end return if self . override? deduction = calculate_deduction if deduction == 0 self . update! ( mark : nil ) elsif deduction > self . criterion . max_mark self . update! ( mark : 0.0 ) else self . update! ( mark : self . criterion . max_mark - deduction ) end end
When a mark is saved, we need to make sure that that
Result has not been released to students
When a mark is saved we need to make sure that that Result has not been released to students