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

Shuffle Question Order in Quiz Assessments/Homeworks #121

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Asp-irin
Copy link

Description

This PR enhances the quiz assessment feature by introducing randomized question shuffling and ensuring accurate response storage under shuffled conditions.

  • Logic Overview:
    • Questions are displayed in a randomized order.
    • Each displayed question is mapped to its original index.
    • User responses are saved at the original index in the backend.

Key Highlights

  • Shuffling Logic: Applied only when the quiz is not of OMR type.
  • Randomized Subsets: Carefully maintains the balance between subset size and total question set size.
  • Index Management: Ensures responses are stored accurately despite shuffling.
  • Session Storage: The random order from the first session is stored and reused across all sessions of the same quiz, ensuring consistency and preventing confusion for the user.

@@ -136,6 +175,7 @@ async def create_session(session: Session):
current_session["time_remaining"] = last_session.get("time_remaining", None)
current_session["has_quiz_ended"] = last_session.get("has_quiz_ended", False)
current_session["metrics"] = last_session.get("metrics", None)
current_session["question_order"] = last_session["question_order"]
Copy link
Collaborator

Choose a reason for hiding this comment

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

you sure this shouldn't have a default value here? i'm wondering if it will cause issues. with previously completed quizzes, etc. this necessitates that we add identity order to all existing sessions, right?

@@ -70,6 +106,9 @@ async def create_session(session: Session):
if last_session is None:
logger.info("No previous session exists for this user-quiz combo")
current_session["is_first"] = True
if not session.omr_mode:
question_order = shuffle_question_order(quiz["question_sets"])
Copy link
Collaborator

Choose a reason for hiding this comment

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

why this variable.. just call the function in next line

bucket_size = Settings().subset_size

global_index = 0 # Track global index across all questions
logger.info(question_sets)
Copy link
Collaborator

@suryabulusu suryabulusu Jan 30, 2025

Choose a reason for hiding this comment

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

why log all questions.

Copy link
Author

Choose a reason for hiding this comment

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

ohh missed it! will remove this.

Copy link
Collaborator

@suryabulusu suryabulusu left a comment

Choose a reason for hiding this comment

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

looks ok to me.. needs tests

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