From 5c584745ae94b7a3b896cfc40aab95e22566c2c7 Mon Sep 17 00:00:00 2001 From: Kfir Dayan Date: Wed, 10 Jan 2024 09:37:05 +0200 Subject: [PATCH] fixed major issue --- services/EventNotifyerService.py | 2 +- services/EventService.py | 9 +++------ 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/services/EventNotifyerService.py b/services/EventNotifyerService.py index 850fa11..86b6890 100644 --- a/services/EventNotifyerService.py +++ b/services/EventNotifyerService.py @@ -9,7 +9,7 @@ class EventNotifyerService: pass def notifyUpcommingEvents(): - events = EventService.get_upcoming_events() + events = EventService.get_all_upcomming_events() for event in events: users = UserService.get_users_with_same_location_but_not_been_notifyed(event['location']) if not users: diff --git a/services/EventService.py b/services/EventService.py index 5800443..ca6ed9b 100644 --- a/services/EventService.py +++ b/services/EventService.py @@ -22,10 +22,8 @@ class EventService: @staticmethod def get_upcoming_events(location=None, sort_by=None): - timedelta = datetime.now() + timedelta(minutes=30) query = Event.query.filter( - Event.deleted == False, - Event.duedate <= timedelta + Event.deleted == False ) if location: query = query.filter(Event.location.ilike(f"%{location}%")) @@ -75,11 +73,10 @@ class EventService: @staticmethod def get_all_upcomming_events(): - now = datetime.now() - upcoming_deadline = now + timedelta(minutes=30) + upcoming_deadline = datetime.now() + timedelta(minutes=30) events = Event.query.filter( - # Event.duedate <= upcoming_deadline, + Event.duedate <= upcoming_deadline, Event.deleted == False ).all()