mirror of
https://github.com/openSUSE/osem.git
synced 2026-08-15 20:54:03 +00:00
Dropdown with date tags in all events
Dropdown with date tags in all events of the schedule
This commit is contained in:
parent
cc031b9f3a
commit
70f30fcb1f
4 changed files with 73 additions and 2 deletions
|
|
@ -91,6 +91,17 @@ class Program < ActiveRecord::Base
|
|||
self.languages.split(',').map {|l| ISO_639.find(l).english_name} if self.languages.present?
|
||||
end
|
||||
|
||||
##
|
||||
# Checks if there is any event in the program that starts in the given date
|
||||
#
|
||||
# ====Returns
|
||||
# * +True+ -> If there is any event for the given date
|
||||
# * +False+ -> If there is not any event for the given date
|
||||
def any_event_for_this_date?(date)
|
||||
parsed_date = DateTime.parse("#{date} 00:00").utc
|
||||
events.where(start_time: parsed_date..(parsed_date + 1)).any?
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
##
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue