Skip to content

Commit

Permalink
Merge pull request #19 from cf15-t5/hotfix/event-repository
Browse files Browse the repository at this point in the history
change strtime
  • Loading branch information
lutfianRhdn authored Aug 21, 2023
2 parents cac63dd + 971acf6 commit 8e119df
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/repositories/EventRepository.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit 8e119df

Please sign in to comment.