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()
|
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(
|
||||||
|
|
Loading…
Reference in a new issue