Fix daily check
This commit is contained in:
@@ -178,13 +178,16 @@ async def get_hits(cards_ids: Union[str, List[str]]) -> List[Hit]:
|
||||
return [Hit(**row) for row in rows]
|
||||
|
||||
|
||||
async def get_hits_today(card_id: Union[str, List[str]]) -> List[Hit]:
|
||||
async def get_hits_today(card_id: str) -> Optional[Hit]:
|
||||
rows = await db.fetchall(
|
||||
f"SELECT * FROM boltcards.hits WHERE card_id = ? AND time >= DATE('now') AND time < DATE('now', '+1 day')",
|
||||
(card_id,),
|
||||
f"SELECT * FROM boltcards.hits WHERE card_id = ?", (card_id,),
|
||||
)
|
||||
updatedrow = []
|
||||
for row in rows:
|
||||
if datetime.now().date() == datetime.fromtimestamp(row.time).date():
|
||||
updatedrow.append(row)
|
||||
|
||||
return [Hit(**row) for row in rows]
|
||||
return [Hit(**row) for row in updatedrow]
|
||||
|
||||
|
||||
async def spend_hit(id: str):
|
||||
|
||||
Reference in New Issue
Block a user