app/models/ecm/courses/course.rb in ecm_courses2-1.1.1 vs app/models/ecm/courses/course.rb in ecm_courses2-1.1.2
- old
+ new
@@ -22,9 +22,10 @@
included do
after_initialize :set_seats_defaults, if: :new_record?
before_validation :calculate_free_seats
validates :used_seats, numericality: { greater_than_or_equal_to: 0 }
+ validates :free_seats, numericality: { greater_than_or_equal_to: 0 }
end
def free_seats_percentage
percentage = free_seats.to_f / seats.to_f * 100
percentage.nan? ? 0 : percentage
\ No newline at end of file