From 82fdc9809159277bcbfeab60d2c16f8260bbf723 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Mon, 12 Aug 2013 19:51:39 +0530 Subject: [PATCH] [fix] [minor] get events --- core/doctype/event/event.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/core/doctype/event/event.py b/core/doctype/event/event.py index b90d3f4327..4381f70f17 100644 --- a/core/doctype/event/event.py +++ b/core/doctype/event/event.py @@ -49,12 +49,12 @@ def get_events(start, end, user=None, for_reminder=False): starts_on, ends_on, owner, all_day, event_type, repeat_this_event, repeat_on, monday, tuesday, wednesday, thursday, friday, saturday, sunday from tabEvent where (( - (starts_on between '%(start)s 00:00:00' and '%(end)s 23:59:59') - or (ends_on between '%(start)s 00:00:00' and '%(end)s 23:59:59') - or (starts_on <= '%(start)s' and ends_on >= '%(end)s') + (date(starts_on) between date('%(start)s') and date('%(end)s')) + or (date(ends_on) between date('%(start)s') and date('%(end)s')) + or (date(starts_on) <= date('%(start)s') and date(ends_on) >= date('%(end)s')) ) or ( - starts_on <= '%(start)s 00:00:00' and ifnull(repeat_this_event,0)=1 and - ifnull(repeat_till, "3000-01-01 00:00:00") > '%(start)s' + date(starts_on) <= date('%(start)s') and ifnull(repeat_this_event,0)=1 and + ifnull(repeat_till, "3000-01-01") > date('%(start)s') )) %(reminder_condition)s and (event_type='Public' or owner='%(user)s' @@ -93,7 +93,7 @@ def get_events(start, end, user=None, for_reminder=False): # repeat for all years in period for year in range(start_year, end_year+1): date = str(year) + "-" + event_start - if date > start and date < end: + if date >= start and date <= end: add_event(e, date) events.remove(e)