Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update all session answers at once #98

Merged
merged 7 commits into from
Aug 14, 2023
Merged

Update all session answers at once #98

merged 7 commits into from
Aug 14, 2023

Conversation

suryabulusu
Copy link
Collaborator

@suryabulusu suryabulusu commented Jul 13, 2023

When a patch request with only session_id is provided to session_answers route, assert that json body contains all session answers, and update all session answers at once in db.

This helps in syncing all session answers from frontend before test ends (especially for OMR format in low network areas).

One test added in test_session_answers.py

Solves #99

Related ADR: https://www.notion.so/avantifellows/ADR-Wait-for-Session-Answer-Response-ce48a939beb240a5b56f5c6035c53931

@codecov
Copy link

codecov bot commented Jul 13, 2023

Codecov Report

Patch coverage: 75.00% and project coverage change: -0.72% ⚠️

Comparison is base (d2767bc) 95.35% compared to head (5b68b82) 94.63%.
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #98      +/-   ##
==========================================
- Coverage   95.35%   94.63%   -0.72%     
==========================================
  Files          18       18              
  Lines         882      914      +32     
==========================================
+ Hits          841      865      +24     
- Misses         41       49       +8     
Files Changed Coverage Δ
app/routers/session_answers.py 77.58% <65.21%> (-8.13%) ⬇️
app/tests/test_session_answers.py 100.00% <100.00%> (ø)

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@suryabulusu suryabulusu temporarily deployed to Staging July 13, 2023 10:44 — with GitHub Actions Inactive
# get user_id and quiz_id for logging
# Note: every session must have these keys
user_id, quiz_id = session["user_id"], session["quiz_id"]
log_message += f"(user: {user_id}, quiz: {quiz_id})"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

more descriptive? as this message will be logged as a separate line, would be helpful for us only to keep it more verbose. For example -- Updating all session answers for the session {session_id} with {user_id} and {quiz_id}

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes ... its a += . log_message variable already has session_id thing

@suryabulusu suryabulusu merged commit b757864 into main Aug 14, 2023
@suryabulusu suryabulusu deleted the all_sess_ans_update branch August 14, 2023 19:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants