Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 toshowCorrectAnswers
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 withshowCorrectAnswers
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:
pg->{answers}
hash.TODO
showCorrectAnswers
precautions