fixed major issue
This commit is contained in:
parent
3eaff8dccf
commit
5c584745ae
2 changed files with 4 additions and 7 deletions
|
@ -9,7 +9,7 @@ class EventNotifyerService:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def notifyUpcommingEvents():
|
def notifyUpcommingEvents():
|
||||||
events = EventService.get_upcoming_events()
|
events = EventService.get_all_upcomming_events()
|
||||||
for event in events:
|
for event in events:
|
||||||
users = UserService.get_users_with_same_location_but_not_been_notifyed(event['location'])
|
users = UserService.get_users_with_same_location_but_not_been_notifyed(event['location'])
|
||||||
if not users:
|
if not users:
|
||||||
|
|
|
@ -22,10 +22,8 @@ class EventService:
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_upcoming_events(location=None, sort_by=None):
|
def get_upcoming_events(location=None, sort_by=None):
|
||||||
timedelta = datetime.now() + timedelta(minutes=30)
|
|
||||||
query = Event.query.filter(
|
query = Event.query.filter(
|
||||||
Event.deleted == False,
|
Event.deleted == False
|
||||||
Event.duedate <= timedelta
|
|
||||||
)
|
)
|
||||||
if location:
|
if location:
|
||||||
query = query.filter(Event.location.ilike(f"%{location}%"))
|
query = query.filter(Event.location.ilike(f"%{location}%"))
|
||||||
|
@ -75,11 +73,10 @@ class EventService:
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_all_upcomming_events():
|
def get_all_upcomming_events():
|
||||||
now = datetime.now()
|
upcoming_deadline = datetime.now() + timedelta(minutes=30)
|
||||||
upcoming_deadline = now + timedelta(minutes=30)
|
|
||||||
events = Event.query.filter(
|
events = Event.query.filter(
|
||||||
|
|
||||||
# Event.duedate <= upcoming_deadline,
|
Event.duedate <= upcoming_deadline,
|
||||||
Event.deleted == False
|
Event.deleted == False
|
||||||
).all()
|
).all()
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue