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

Starting a cleanup push #13

Open
wants to merge 13 commits into
base: develop
Choose a base branch
from

Conversation

drdrew42
Copy link
Sponsor Member

This PR expands on #11, which should be merged first.

Changes

Absolute URLs

Stop relying on base href and instead use absolute URLs in templates.

problemJWT

Convert all requests to use JWTs.

Problem render requests are pre-processed into a problemJWT, capturing the original request parameters. The problemJWT is then stashed in the sessionJWT (which also keeps track of the most recently submitted answers), ensuring consistent settings throughout multiple interactions.

In production, this means that a stored sessionJWT is capable of re-rendering any submission. If the LMS needs to change any of the problem parameters, a new problemJWT may be submitted along with the stored sessionJWT in order to override the existing parameters in the sessionJWT. Further interaction with the problem will use the new problemJWT in place of the old one (so the new problemJWT must be complete, rather than considered as a patch to the existing problemJWT).

showCorrectAnswers

Any parameter set by the problemJWT is not override-able. If a user should be blocked from showCorrectAnswers, it must be set to false in the initial problemJWT. However, this then blocks the user from ever being able to showCorrectAnswers without replacing the problemJWT. (This may be the preferred solution.)

If however, showCorrectAnswers is not secured: whenever this parameter is included in a request, it will be stored in the sessionJWT where it cannot be removed. Rendering a problem with showCorrectAnswers will further lock the JWT into rendering in static format, preventing any further interaction.

@drgrice1 - this is the purpose for having a static option either with mqeditor, or otherwise loadable from the static template -- if an LMS implements their own submit buttons, this implementation will not suffice. This precaution should probably be expanded upon.

base64 source

problemSource is no longer required to be base64 encoded.

AFAIK, there's no longer any need for base64 encoding, but for backwards compatibility, it is recognized and supported when a request provides problemSource.

RenderProblem cleanup

Cleanup and streamline the RenderProblem.pm file.

Minor changes to functionality:

  • Preparation for restructuring answerJWT, which currently sends the entire pg->{answers} hash.
  • SessionJWTs will cease updating attempt counts once a correct attempt has been scored.

TODO

  • Convert FormatRenderedProblem to follow the ww2 approach of using Mojo::Templates.
  • Expand on showCorrectAnswers precautions
  • LINTING
  • ???

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.

1 participant