Fixed wrong $in usage

This commit is contained in:
Profitroll 2023-08-30 13:00:21 +02:00
parent c303f62005
commit 42ca71aa3e
Signed by: profitroll
GPG Key ID: FA35CAB49DACD3B2
2 changed files with 9 additions and 17 deletions

View File

@ -39,7 +39,7 @@ async def remind(app: PyroClient) -> None:
entries = await col_entries.find(
{
"locations": {"$in": location.id},
"locations": location.id,
"date": user_date.replace(hour=0, minute=0),
}
).to_list()

View File

@ -34,23 +34,15 @@ async def command_upcoming(app: PyroClient, message: Message):
+ timedelta(days=30)
).replace(tzinfo=timezone.utc)
try:
entries = [
await GarbageEntry.from_record(entry)
async for entry in col_entries.find(
{
"locations": {"$in": user.location.id},
"date": {"$gte": date_min, "$lte": date_max},
}
)
]
except OperationFailure:
await message.reply_text(
app._("upcoming_empty", "messages", locale=user.locale).format(
name=user.location.name
)
entries = [
await GarbageEntry.from_record(entry)
async for entry in col_entries.find(
{
"locations": user.location.id,
"date": {"$gte": date_min, "$lte": date_max},
}
)
return
]
entries_text = "\n\n".join(
[