You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
educoder/app/models/homework_group_setting.rb

12 lines
761 B

6 years ago
class HomeworkGroupSetting < ApplicationRecord
belongs_to :homework_common
belongs_to :course
scope :group_published, -> {where("homework_group_settings.publish_time IS NOT NULL AND homework_group_settings.publish_time <= ?", Time.now)}
scope :none_published, -> {where("homework_group_settings.publish_time IS NULL OR homework_group_settings.publish_time > ?", Time.now)}
scope :published_no_end, -> {where("homework_group_settings.publish_time IS NOT NULL AND homework_group_settings.publish_time < ?
and homework_group_settings.end_time > ?", Time.now, Time.now)}
scope :none_end, -> {where("homework_group_settings.end_time IS NOT NULL AND homework_group_settings.end_time > ?", Time.now)}
end