WIP: Skills question endpoint#798
Open
barna-isaac wants to merge 31 commits into
Open
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #798 +/- ##
==========================================
+ Coverage 40.25% 40.62% +0.37%
==========================================
Files 547 553 +6
Lines 23810 23937 +127
Branches 2901 2909 +8
==========================================
+ Hits 9584 9725 +141
+ Misses 13323 13306 -17
- Partials 903 906 +3 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
| RegisteredUserDTO currentUser = userManager.getCurrentRegisteredUser(request); | ||
| if (!(this.contentManager.getContentDOById(appId) instanceof AnvilApp)) { | ||
| var error = new SegueErrorResponse(Status.NOT_FOUND, "No app found for given id: " + appId); | ||
| log.warn(error.getErrorMessage()); |
for consistency with how the questions endpoint works
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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 adds a new endpoint, meant for Anvil apps to record new question attempts.
For now, the new endpoint:
logged_eventstableI plan to implement this functionality later, when the feature is more mature.
Testing
I've manually tested that attempts are recorded on my own machine, by visiting http://localhost:8004/pages/app_page_mental_maths_overall, opening the JS console, and intercepting one of the messages emitted by the app:
Then, a request can be posted with the following curl:
Overview of changes
To help with the review, here is a high-level list of changes:
17 changed files in total.
11 changes to the implementation
InvalidAnvilMarkingRequestException.java,AnvilMarkingRequestDTO.java,AnvilPayloadDTO.java. Two DTO's because the HMAC'ed payload is first validated, and only then parsed.SkillsFacade.java,SkillsManager.java,ISkillsAttemptManager.java,PgSkillsAttemptManager.java, mirroring the Manager <-> IPersistenceManager <-> PersistenceManager pattern for question attemptsConstants.java,IsaacApplicationRegister.java,SegueGuiceConfigurationModule.java, and a migration in2026-06-skills_question_attempts.sql6 changes to testing
SkillsFacadeIT.java,postgres-rutherford-create-script.sqlto apply the new db schema for testing, andsegue-integration-test-config.yamlso the new config value is set for test.ElasticSearchTestHelper.java,QuestionFacadeIT.java,IsaacIntegrationTestWithRest.javabecause I've extracted a helper method from QuestionFacadeIT, so the same method can be reused in the new tests. The method lets us add content to elastic search. Further, the test server now applies the same exception handlers as the live app.Pull Request Check List
Security - New dependency - configured sensibly not relying on defaultsSecurity - New dependency - Searched for any know vulnerabilitiesSecurity - New dependency - Signed up team to mailing listSecurity - New dependency - Added to dependency list