fixed major issue

This commit is contained in:
Kfir Dayan 2024-01-10 09:37:05 +02:00
parent 3eaff8dccf
commit 5c584745ae
2 changed files with 4 additions and 7 deletions

View file

@ -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:

View file

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