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