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

Add Chauffeur Quiz to MSP #168

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Conversation

patrickm02L
Copy link
Member

@patrickm02L patrickm02L commented Dec 20, 2024

Description

This PR implements a comprehensive quiz system for chauffeur permit testing, featuring a 25-question randomized assessment with strict attempt controls (3 attempts max, 24-hour cooling period) and UTC-6 time handling. The system requires user authentication to track individual progress and provides admin oversight of all quiz attempts and scores, while ensuring consistent timezone handling across all users.

Closes #18570

Success Criteria

  • Quiz timestamps are correctly stored in UTC-6
  • 24-hour waiting period works correctly
  • 3-attempt limit is enforced
  • Maximum attempts message includes staff contact instructions
  • All quiz results are accurately recorded
  • UI provides clear feedback at all stages

Testing Environment

Knack Test Environment Access

Testing Steps

1. Quiz Taking Flow

  1. Log in as a Customer
  2. Navigate to the Quiz page
  3. Select and complete a quiz
  4. Verify:
    • Questions display correctly
    • Progress bar works
    • Score is calculated accurately
    • Final results screen shows correct information

2. Quiz Results Verification

  1. Log in as an Admin
  2. Navigate to the Quiz Results page
  3. Verify the latest quiz attempt:
    • Timestamp is correct (UTC-6)
    • Score percentage is accurate
    • Number of correct answers matches
    • Quiz-taker information is correct

3. Testing 24-Hour Wait Period

  1. Try to take the same quiz again immediately
  2. Verify:
    • "Waiting Period Required" message appears
    • Correct number of remaining hours is displayed
    • Correct number of remaining attempts is shown

4. Testing Multiple Attempts

  1. As an Admin, locate the quiz attempt in the Quiz Results table
  2. Edit the timestamp to be >24 hours old
  3. Return to the Customer view
  4. Take the quiz again
  5. Verify:
    • Quiz allows a new attempt
    • Results are recorded correctly
    • Remaining attempts counter updates accurately

5. Testing Maximum Attempts Message

  1. Complete all 3 attempts for a quiz
  2. Try to access the quiz again
  3. Verify:
    • "Maximum Attempts Reached" message appears
    • Message states "You have already attempted this quiz 3 times"
    • Instructions to "contact staff for instructions on retesting at a later date" are displayed
    • "Back to Quiz Home" button works correctly

@dianamartin
Copy link
Contributor

@patrickm02L I'm reviewing this PR and feeling hesitant about how much code was used to create this quiz. I think we need to have a formal technical review of the app before this PR can get approved. Please include all Apps team members. @chiaberry, would you want anyone from your team to be present for this meeting?

I know @johnclary already commented about us needing to take a different approach re: authenticating requests in Knack custom code.

Please work with @KaroEngstrom to put something on the calendar

- Replace all direct $.ajax calls with Knack.api methods in quiz functionality
- Remove custom headers configuration as they're handled by Knack.api
- Maintain existing functionality while using official Knack API methods
- Fix 403 and CORS errors in quiz data fetching

This change addresses security updates in Knack's API that now require
using their official API methods instead of direct AJAX calls.
@patrickm02L
Copy link
Member Author

Hey everyone, I'm going suspend review for now. There was a major refactor that needed to occur to hide the API key, and has now resulted in some new issues.

@johnclary I rotated the key and it is now set to a key value. Shout out to @ChrispinP for helping me to use best practice to obscure the API secret.

@chiaberry
Copy link
Member

@dianamartin is the formal technical review you are describing of the entire app or just for the quiz?

In either case, you can include me in the eventual meeting invite

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants