Class Mark
In: app/models/mark.rb
Parent: ActiveRecord::Base

Methods

get_mark   validate  

Public Instance methods

return the current mark for this criterion

[Source]

    # File app/models/mark.rb, line 25
25:   def get_mark
26:     criterion = self.markable
27:     weight = criterion.get_weight
28:     return mark.to_f * weight
29:   end

[Source]

    # File app/models/mark.rb, line 16
16:   def validate
17:     if self.markable_type == "RubricCriterion" and !self.mark.nil? and (self.mark > 4 or self.mark < 0)
18:       errors.add(:mark, I18n.t("mark.error.validate_rubric"))
19:     end
20:     if self.markable_type == "FlexibleCriterion" and !self.mark.nil? and (self.mark > self.markable.max or self.mark < 0)
21:       errors.add(:mark, I18n.t("mark.error.validate_flexible"))
22:     end
23:   end

[Validate]