From 971acf65ea25a96941caab2759d463eb33cbf5db Mon Sep 17 00:00:00 2001 From: Lutfian Rhdn Date: Mon, 21 Aug 2023 12:46:39 +0700 Subject: [PATCH] change strtime --- src/repositories/EventRepository.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/repositories/EventRepository.py b/src/repositories/EventRepository.py index 18f8771..b62d244 100644 --- a/src/repositories/EventRepository.py +++ b/src/repositories/EventRepository.py @@ -10,14 +10,12 @@ def getAllEventFiltered(self,filters): events = Event.query.all() # print('filters',filters) - print('events',events[0].date_of_event) - date_datetime = datetime.strptime(filters['date'], '%Y-%m-%d') filtered_events = [event for event in events if (not filters['province'] or event.address.split(',')[3].strip()== filters['province']) and (not filters['city'] or event.address.split(',')[2].strip() == filters['city']) and (not filters['district'] or event.address.split(',')[1].strip() == filters['district'] ) and (not filters['category'] or str(event.category_id) == filters['category']) and - (not filters['date'] or event.date_of_event.date() == date_datetime.date()) + (not filters['date'] or event.date_of_event.date() == datetime.strptime(filters['date'], '%Y-%m-%d').date()) ] return filtered_events def createNewEvent(self,title,description,price,date_of_event,number_of_ticket,user_id,poster_path,address,category_id):