diff --git a/app/calendar_system/gregorian.py b/app/calendar_system/gregorian.py index 3dc5b2d..162bfd6 100644 --- a/app/calendar_system/gregorian.py +++ b/app/calendar_system/gregorian.py @@ -46,3 +46,19 @@ class GregorianCalendar(CalendarSystem): day_list.append(current_day) return day_list + + def day_events(self, date, user=None): + from app.models import Event + + events = Event.query + + if user: + events = events.filter(Event.user == user) + + start_timestamp = date.replace(hour=0, minute=0, second=0, microsecond=0) + end_timestamp = start_timestamp + timedelta(days=1) + + events = events.filter(((Event.start_time >= start_timestamp) & (Event.start_time < end_timestamp)) | + ((Event.end_time >= start_timestamp) & (Event.end_time < end_timestamp))) + + return events diff --git a/app/templates/month-view.html b/app/templates/month-view.html index 792d06c..f5df1db 100644 --- a/app/templates/month-view.html +++ b/app/templates/month-view.html @@ -70,11 +70,11 @@ {%- endif %}