Skip to content

Endpoint for skills on my progress - #808

Merged
barna-isaac merged 15 commits into
mainfrom
feature/skills-on-my-progress
Jul 14, 2026
Merged

Endpoint for skills on my progress#808
barna-isaac merged 15 commits into
mainfrom
feature/skills-on-my-progress

Conversation

@barna-isaac

@barna-isaac barna-isaac commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

This adds an endpoint to show skills on My Progress.

It's just the one app for now, and given how close the symposium is, the following are hardcoded:

  • this only ever shows attempts from the Mental Maths Practice App. The UI is hardcoded to only show this (we don't have app discovery yet), but I thought it might be a privacy concern having the endpoint return more data than is visible to users on the UI. In the privacy policy, we tell users to expect their teachers seeing the contents of their My Progress page, so I thought it important that this data is indeed what's accessible to a teacher.
  • for now, always shows results from the past year. In the future, these will probably be parameters, but I didn't want to introduce them just yet (it'd be extra work validating these)
  • For now, this is not cached, but if @jsharkey13 thinks this would important, I can get it done quickly!
  • Not a concern for now as there's just the one app, but I wondered if @jsharkey13 has a preference whether to always return results from all apps, or for the app to be a parameter and return results just for the requested app. The second is simpler, while the first might be more performant.

Pull Request Check List

  • Unit Tests & Regression Tests Added (Optional)
  • Removed Unnecessary Logs/System.Outs/Comments/TODOs
  • Added enough Logging to monitor expected behaviour change
  • Security - Injection - everything run by an interpreter (SQL, OS...) is either validated or escaped
  • Security - Data Exposure - PII is not stored or sent unencrypted
  • [] Security - Data Exposure - Test any altered or created endpoints using swagger
  • Security - Access Control - Check authorisation on every new endpoint
  • ~[ ] Security - New dependency - configured sensibly not relying on defaults
  • ~[ ] Security - New dependency - Searched for any know vulnerabilities
  • ~[ ] Security - New dependency - Signed up team to mailing list
  • ~[ ] Security - New dependency - Added to dependency list
  • ~[ ] DB schema changes - postgres-rutherford-create-script updated
  • ~[ ] DB schema changes - upgrade script created matching create script
  • ~[ ] Updated Release Procedure & Documentation (& Considered Implications to Previous Versions)
  • Peer-Reviewed

@barna-isaac
barna-isaac marked this pull request as draft July 10, 2026 11:54
@codecov

codecov Bot commented Jul 10, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 84.21053% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 40.96%. Comparing base (d7e3726) to head (91a1665).

Files with missing lines Patch % Lines
.../java/uk/ac/cam/cl/dtg/isaac/api/SkillsFacade.java 81.81% 4 Missing ⚠️
...g/isaac/dao/PgSkillsAttemptPersistenceManager.java 85.71% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #808      +/-   ##
==========================================
+ Coverage   40.89%   40.96%   +0.07%     
==========================================
  Files         550      550              
  Lines       23504    23540      +36     
  Branches     2831     2834       +3     
==========================================
+ Hits         9611     9644      +33     
- Misses      13026    13027       +1     
- Partials      867      869       +2     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Comment thread src/test/java/uk/ac/cam/cl/dtg/isaac/api/SkillsFacadeIT.java Fixed
Comment thread src/main/java/uk/ac/cam/cl/dtg/isaac/api/SkillsFacade.java Fixed
Comment thread src/main/java/uk/ac/cam/cl/dtg/isaac/api/SkillsFacade.java Fixed
Comment thread src/test/java/uk/ac/cam/cl/dtg/isaac/api/SkillsFacadeIT.java Dismissed
Comment thread src/test/java/uk/ac/cam/cl/dtg/isaac/api/SkillsFacadeIT.java Fixed
Comment thread src/test/java/uk/ac/cam/cl/dtg/isaac/api/SkillsFacadeIT.java Dismissed
@barna-isaac
barna-isaac marked this pull request as ready for review July 13, 2026 13:13
@barna-isaac barna-isaac changed the title endpoint for skills on my progress Endpoint for skills on my progress Jul 13, 2026
Comment thread src/main/java/uk/ac/cam/cl/dtg/isaac/api/SkillsFacade.java
DATE_TRUNC('month', timestamp::DATE) AS dt,
COUNT(1) AS cnt
FROM skills_question_attempts
WHERE user_id = ? AND timestamp >= ? AND skill_id = ? AND LENGTH(question_attempt->>'result') > 0

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This query is complex!

Why do we need the length verification of attempts? I thought each attempt was stored separately, and surely we don't store empty attempts since even sending them to the API would waste bandwidth, server resources and time?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@jacbn has also raised this! #798 (comment). I wanted to record empty attempts because I wanted us to later have the option to be strict about also counting these. What the strict thing is depends will depend on the target. If it's something like "number of attempts", where the target is in the numerator, the strict thing to do is to drop these. If it's something like "percentage of correct attempts", where the total number is in the denominator, the strict thing to do is to keep these.

Are you worried about how this query might perform or whether the empty attempts will take up too much space in the database?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@jsharkey13 and I have agreed to stop recording empty attempts. The Anvil app should stop sending these, and the API shouldn't allow any. Recording empty attempts is not an effective way to protect against a user that only wants to submit easy answers, as they could just refresh the page.

@barna-isaac

Copy link
Copy Markdown
Contributor Author

We'll apply the suggested changes as a separate refactor.

@barna-isaac
barna-isaac merged commit 17a6707 into main Jul 14, 2026
5 checks passed
@barna-isaac
barna-isaac deleted the feature/skills-on-my-progress branch July 14, 2026 10:02
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.

3 participants