Skip to content

Commit

Permalink
feat: edit history deadline
Browse files Browse the repository at this point in the history
  • Loading branch information
baebae02 committed Nov 23, 2023
1 parent 74435ac commit 8dffcd2
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions app/utils/pray.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,27 +152,27 @@ def get_storages(args='date') -> List[StorageDTO]:
if args == 'date':
storages_completed = Storage.query.join(Complete)\
.filter_by(user_id=g.user_id)\
.filter(func.DATE(Storage.deadline) > today) \
.filter(func.DATE(Storage.deadline) >= today) \
.filter(Complete.created_at >= midnight)\
.filter(Storage.deleted_at == None)\
.order_by(Storage.deadline).all()
storages_uncompleted = Storage.query.outerjoin(Complete)\
.filter(Storage.user_id == g.user_id)\
.filter(Storage.deleted_at == None)\
.filter(func.DATE(Storage.deadline) > today) \
.filter(func.DATE(Storage.deadline) >= today) \
.filter((Complete.created_at < midnight) | (Complete.created_at == None))\
.order_by(Storage.deadline).all()
elif args == 'cnt':
storages_completed = Storage.query.join(Complete)\
.filter_by(user_id=g.user_id)\
.filter(Storage.deleted_at == None)\
.filter(func.DATE(Storage.deadline) > today) \
.filter(func.DATE(Storage.deadline) >= today) \
.filter(Complete.created_at >= midnight)\
.order_by(Storage.pray_cnt).all()
storages_uncompleted = Storage.query.outerjoin(Complete)\
.filter(Storage.user_id == g.user_id)\
.filter(Storage.deleted_at == None)\
.filter(func.DATE(Storage.deadline) > today) \
.filter(func.DATE(Storage.deadline) >= today) \
.filter((Complete.created_at < midnight) | (Complete.created_at == None))\
.order_by(Storage.pray_cnt).all()
storage_completed_dtos = [
Expand Down Expand Up @@ -322,13 +322,13 @@ def get_history(content):
today = current_time.date()
if content['sort_by'] == 'cnt':
storages = Storage.query.filter_by(user_id=g.user_id)\
.filter(func.DATE(Storage.deadline) <= today)\
.filter(func.DATE(Storage.deadline) < today)\
.filter(Storage.deleted_at == None)\
.order_by(Storage.pray_cnt.desc())\
.paginate(page=content['page'], per_page=content['per_page'], error_out=False)
else:
storages = Storage.query.filter_by(user_id=g.user_id)\
.filter(func.DATE(Storage.deadline) <= today)\
.filter(func.DATE(Storage.deadline) < today)\
.filter(Storage.deleted_at == None)\
.order_by(Storage.created_at.desc())\
.paginate(page=content['page'], per_page=content['per_page'], error_out=False)
Expand Down

0 comments on commit 8dffcd2

Please sign in to comment.