2019-05-28 15:54:32 +00:00
|
|
|
class PaperCriteria
|
|
|
|
include Mongoid::Document
|
|
|
|
include Mongoid::Timestamps
|
|
|
|
include Slug
|
|
|
|
|
|
|
|
field :title,as: :slug_title, localize: true
|
|
|
|
field :description, localize: true
|
|
|
|
field :start_date, type: DateTime
|
|
|
|
field :end_date, type: DateTime
|
|
|
|
field :sending_time, type: DateTime
|
|
|
|
field :sending_title, localize: true
|
|
|
|
field :sending_notes
|
2019-07-01 12:06:33 +00:00
|
|
|
field :language_to_send, type: Array, :default => ["en","zh_tw"]
|
|
|
|
field :receivers, type: Array, :default => ["subscriber"]
|
2019-05-28 15:54:32 +00:00
|
|
|
field :other_emails
|
|
|
|
|
|
|
|
|
|
|
|
def epaper_topics
|
|
|
|
EPaperTopic.where(:period.gte => self.start_date, :period.lte => self.end_date).can_display
|
|
|
|
end
|
2019-07-01 12:06:33 +00:00
|
|
|
|
|
|
|
def other_emails_ids
|
|
|
|
if !self.other_emails.nil?
|
|
|
|
return self.other_emails.split(",")
|
|
|
|
else
|
|
|
|
return []
|
|
|
|
end
|
|
|
|
end
|
2019-05-28 15:54:32 +00:00
|
|
|
|
|
|
|
end
|