From af15a4a496f0699799a9df3d446372a4efb63f89 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Fri, 26 Jul 2013 19:03:04 +0530 Subject: [PATCH] [event] [minor fixes] --- startup/open_count.py | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/startup/open_count.py b/startup/open_count.py index 7a4866b5aa..04e00297b1 100644 --- a/startup/open_count.py +++ b/startup/open_count.py @@ -41,14 +41,10 @@ def get_things_todo(): def get_todays_events(): """Returns a count of todays events in calendar""" + from core.doctype.event.event import get_events from webnotes.utils import nowdate - todays_events = webnotes.conn.sql("""\ - SELECT COUNT(*) FROM `tabEvent` - WHERE owner = %s - AND event_type != 'Cancel' - AND %s between date(starts_on) and date(ends_on)""", ( - webnotes.session.user, nowdate())) - return todays_events[0][0] + today = nowdate() + return len(get_events(today, today)) def get_unread_messages(): "returns unread (docstatus-0 messages for a user)"