Fix little bug and simplified use

This commit is contained in:
Stefano Assenzo 2023-01-27 15:27:13 +00:00 committed by GitHub
parent 464152de50
commit 6ad24a92a7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 20 additions and 1 deletions

View File

@ -60,13 +60,32 @@ async def change_school_time(
), ),
hour_school: Option(str, hour_school: Option(str,
"Select hour school", "Select hour school",
choices=["1", "2", "3", "4", "5", "6"], choices=["First hour", "Second hour", "Third hour", "Fourth hour", "Fifth hour", "Sixth hour", "Seventh hour", "Eighth hour", "Ninth hour"],
required=True, required=True,
), text: str ), text: str
): ):
await ctx.respond(f"Day selected: {day}, Hour school selected: {hour_school}, Text: {text}") await ctx.respond(f"Day selected: {day}, Hour school selected: {hour_school}, Text: {text}")
# Update the subject on MongoDB # Update the subject on MongoDB
if hour_school == "First hour":
hour_school = "0"
elif hour_school == "Second hour":
hour_school = "1"
elif hour_school == "Third hour":
hour_school = "2"
elif hour_school == "Fourth hour":
hour_school = "3"
elif hour_school == "Fifth hour":
hour_school = "4"
elif hour_school == "Sixth hour":
hour_school = "5"
elif hour_school == "Seventh hour":
hour_school = "6"
elif hour_school == "Eighth hour":
hour_school = "7"
elif hour_school == "Ninth hour":
hour_school = "8"
find_document = list(collection.find({}, {"Date": long_date})) find_document = list(collection.find({}, {"Date": long_date}))
array_document = find_document[0]["_id"] array_document = find_document[0]["_id"]
collection.update_one( collection.update_one(