mirror of
https://code.lenaisten.de/Lenaisten/advent22.git
synced 2024-11-23 00:03:07 +00:00
get Number
This commit is contained in:
parent
8269d8c976
commit
b823aeaa69
1 changed files with 14 additions and 9 deletions
|
@ -32,18 +32,23 @@ async def get_date() -> str:
|
|||
return date.today().isoformat()
|
||||
|
||||
|
||||
@router.get("/number")
|
||||
async def get_number() -> int:
|
||||
today = date.today()
|
||||
|
||||
if today.month == 12:
|
||||
return today.day
|
||||
|
||||
if today.month in (1, 2, 3):
|
||||
return 24
|
||||
|
||||
return 0
|
||||
|
||||
|
||||
async def user_can_view(
|
||||
index: int,
|
||||
) -> bool:
|
||||
today = date.today()
|
||||
|
||||
if today.month in (1, 2, 3):
|
||||
return True
|
||||
|
||||
elif today.month == 12:
|
||||
return index < today.day
|
||||
|
||||
return False
|
||||
return index < await get_number()
|
||||
|
||||
|
||||
@router.get(
|
||||
|
|
Loading…
Reference in a new issue