Skip to content

Commit

Permalink
returns prints temp
Browse files Browse the repository at this point in the history
  • Loading branch information
suryabulusu committed May 22, 2024
1 parent 6124420 commit 25085b2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 14 deletions.
10 changes: 5 additions & 5 deletions app/routers/quizzes.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ async def generate_review_quiz(review_params: GenerateReviewQuiz):

if quiz is None:
print("No quiz exists for given id")
return
return None

Check warning on line 247 in app/routers/quizzes.py

View check run for this annotation

Codecov / codecov/patch

app/routers/quizzes.py#L245-L247

Added lines #L245 - L247 were not covered by tests

if (

Check warning on line 249 in app/routers/quizzes.py

View check run for this annotation

Codecov / codecov/patch

app/routers/quizzes.py#L249

Added line #L249 was not covered by tests
"is_review_quiz_requested" not in quiz
Expand All @@ -263,11 +263,11 @@ async def generate_review_quiz(review_params: GenerateReviewQuiz):
MessageStructure="string",
)
if response["ResponseMetadata"]["HTTPStatusCode"] == 200:
print(
"Requested For Review Quiz Generation. Please wait for a few minutes."
)
quiz["is_review_quiz_requested"] = True
client.quiz.quizzes.update_one({"_id": quiz_id}, {"$set": quiz})
return (

Check warning on line 268 in app/routers/quizzes.py

View check run for this annotation

Codecov / codecov/patch

app/routers/quizzes.py#L265-L268

Added lines #L265 - L268 were not covered by tests
"Requested For Review Quiz Generation. Please wait for a few minutes."
)
else:
print("Request failed.")
elif (

Check warning on line 273 in app/routers/quizzes.py

View check run for this annotation

Codecov / codecov/patch

app/routers/quizzes.py#L272-L273

Added lines #L272 - L273 were not covered by tests
Expand All @@ -280,7 +280,7 @@ async def generate_review_quiz(review_params: GenerateReviewQuiz):
if review_quiz is not None:
return review_quiz["_id"]

Check warning on line 281 in app/routers/quizzes.py

View check run for this annotation

Codecov / codecov/patch

app/routers/quizzes.py#L280-L281

Added lines #L280 - L281 were not covered by tests
else:
print(f"Review quiz for {quiz_id} is still being generated. Please wait.")
return f"Review quiz for {quiz_id} is still being generated. Please wait."

Check warning on line 283 in app/routers/quizzes.py

View check run for this annotation

Codecov / codecov/patch

app/routers/quizzes.py#L283

Added line #L283 was not covered by tests


@router.post("/review", response_model=CreateQuizResponse)
Expand Down
16 changes: 7 additions & 9 deletions app/routers/sessions.py
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ async def generate_review_quiz_for_session(review_params: GenerateReviewQuizForS

if session is None:
print("No session exists for given user+quiz combo")
return
return None

Check warning on line 342 in app/routers/sessions.py

View check run for this annotation

Codecov / codecov/patch

app/routers/sessions.py#L340-L342

Added lines #L340 - L342 were not covered by tests

if session["has_quiz_ended"] is True and (

Check warning on line 344 in app/routers/sessions.py

View check run for this annotation

Codecov / codecov/patch

app/routers/sessions.py#L344

Added line #L344 was not covered by tests
"is_review_quiz_requested" not in session
Expand All @@ -359,14 +359,14 @@ async def generate_review_quiz_for_session(review_params: GenerateReviewQuizForS
)

if response["ResponseMetadata"]["HTTPStatusCode"] == 200:
print(
"Requested For Review Quiz Generation. Please wait for a few minutes."
)
session["is_review_quiz_requested"] = True
client.quiz.sessions.update_one({"_id": session["_id"]}, {"$set": session})

Check warning on line 363 in app/routers/sessions.py

View check run for this annotation

Codecov / codecov/patch

app/routers/sessions.py#L361-L363

Added lines #L361 - L363 were not covered by tests
# this could lead to creation of new session when quiz UI opened again. check it
return (

Check warning on line 365 in app/routers/sessions.py

View check run for this annotation

Codecov / codecov/patch

app/routers/sessions.py#L365

Added line #L365 was not covered by tests
"Requested For Review Quiz Generation. Please wait for a few minutes."
)
else:
print("Request failed.")
return "Request failed."

Check warning on line 369 in app/routers/sessions.py

View check run for this annotation

Codecov / codecov/patch

app/routers/sessions.py#L369

Added line #L369 was not covered by tests

elif (

Check warning on line 371 in app/routers/sessions.py

View check run for this annotation

Codecov / codecov/patch

app/routers/sessions.py#L371

Added line #L371 was not covered by tests
session["has_quiz_ended"] is True
Expand All @@ -384,9 +384,7 @@ async def generate_review_quiz_for_session(review_params: GenerateReviewQuizForS
review_quiz_id = review_quiz["_id"]
return review_quiz_id

Check warning on line 385 in app/routers/sessions.py

View check run for this annotation

Codecov / codecov/patch

app/routers/sessions.py#L383-L385

Added lines #L383 - L385 were not covered by tests
else:
print(
f"Review Quiz for {user_id}+{quiz_id} is being generated. Please wait."
)
f"Review Quiz for {user_id}+{quiz_id} is being generated. Please wait."

elif session["has_quiz_ended"] is False:
print("Please complete the quiz before requesting for review!")
return "Please complete the quiz before requesting for review!"

Check warning on line 390 in app/routers/sessions.py

View check run for this annotation

Codecov / codecov/patch

app/routers/sessions.py#L389-L390

Added lines #L389 - L390 were not covered by tests

0 comments on commit 25085b2

Please sign in to comment.