Skip to content
This repository has been archived by the owner on Apr 17, 2024. It is now read-only.

Commit

Permalink
Match part of event_date for users lock
Browse files Browse the repository at this point in the history
Add the possibility to list locks for a user for a specific year
  • Loading branch information
parberge committed Jun 30, 2020
1 parent 4b1efec commit fa002d6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ def get_lock(user_id, event_date):
:param event_date:
:return:
"""
return db_v2.get_lock_by_user_id_and_date(user_id=user_id, event_date=event_date)
return db_v2.get_locks_by_user_id_and_date(user_id=user_id, event_date=event_date)


@app.route("/lock", methods=["POST"], cors=True)
Expand Down
4 changes: 2 additions & 2 deletions chalicelib/lib/db_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,14 +138,14 @@ def delete_all_locks_by_user_id(user_id):
)


def get_lock_by_user_id_and_date(user_id, event_date):
def get_locks_by_user_id_and_date(user_id, event_date):
"""
:param user_id:
:param event_date:
:return: lock for user
"""
scan = LockTable.scan(
(LockTable.user_id == user_id) & (LockTable.event_date == event_date)
(LockTable.user_id == user_id) & (LockTable.event_date.startswith(event_date))
)
locks = []
for lock in scan:
Expand Down

0 comments on commit fa002d6

Please sign in to comment.