Skip to content

Conversation

@markadodo
Copy link

@markadodo markadodo commented Feb 5, 2026

Description

This PR fixes an abstraction violation in XP calculation.

Problem: The previous code first queries the database in Elixir to get team and submission IDs, then it queries the submission table again using those IDs. This mixes app-level logic with DB logic, breaking the abstraction.

Solution: Do all filtering and joining directly in the database using Ecto joins.

Fixes: #1169

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update
  • Code quality improvements

How to test

Run

mix test test/cadet/assessments/assessments_test.exs

in the terminal

alternatively:

  1. Change the XP of a submission of a student
  2. Check if it has been reflected correctly

Checklist

  • I have tested this code
  • I have updated the documentation

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.

Abstraction violation

1 participant