From 48ad0401bdf7dc1161d952c64c44c7eaeb8653bd Mon Sep 17 00:00:00 2001 From: Lutfian Rhdn Date: Mon, 21 Aug 2023 01:50:06 +0700 Subject: [PATCH 1/2] bugfix:fix requirement.txt and add migration :bug: --- .github/workflows/deployment.yaml | 1 + requirement.txt | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/deployment.yaml b/.github/workflows/deployment.yaml index 5231c6b..4f944c1 100644 --- a/.github/workflows/deployment.yaml +++ b/.github/workflows/deployment.yaml @@ -46,5 +46,6 @@ jobs: export FLASK_APP=server.py git pull pip install -r requirement.txt + flask db upgrade pm2 restart seticket-backend diff --git a/requirement.txt b/requirement.txt index 866cd38..ed78b1a 100644 --- a/requirement.txt +++ b/requirement.txt @@ -8,4 +8,4 @@ pydantic==2.1.1 pydantic[email]==2.1.1 werkzeug==2.3.3 pyjwt==2.8.0 -Flask-Migrate=4.0.4 \ No newline at end of file +Flask-Migrate==4.0.4 \ No newline at end of file From 971acf65ea25a96941caab2759d463eb33cbf5db Mon Sep 17 00:00:00 2001 From: Lutfian Rhdn Date: Mon, 21 Aug 2023 12:46:39 +0700 Subject: [PATCH 2/2] 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):