get Number

This commit is contained in:
penner 2022-12-14 02:48:35 +00:00
parent 8269d8c976
commit b823aeaa69

View file

@ -32,18 +32,23 @@ async def get_date() -> str:
return date.today().isoformat() 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( async def user_can_view(
index: int, index: int,
) -> bool: ) -> bool:
today = date.today() return index < await get_number()
if today.month in (1, 2, 3):
return True
elif today.month == 12:
return index < today.day
return False
@router.get( @router.get(