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()