Primary
Attribute for Score Set Ranges
#532
Open
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 pull request introduces a new "primary" flag to score range models and enforces validation to ensure only one score range set is marked as primary. It also adds support for a new Fayer calibration score range schema and updates related test constants and test cases to reflect these changes.
Score Range Model Enhancements:
primary
boolean field to all score range models (ScoreRangesAdminCreate
,SavedScoreRanges
, and their specialized subclasses), allowing each score range set to be marked as primary. [1] [2] [3] [4] [5] [6] [7]Admin
class. This class is not used in the code base so as not to allow users to submit ranges with the flag applied. However, submission of ranges would overwrite the existing admin class with a new range object without the flag set. Since score sets with ranges are generally published, this shouldn't be an allowed operation anyway. With that said, we should explore solutions thatValidation Logic:
model_validator
forSavedScoreSetRanges
to ensure that at most one score range set is marked as primary. If none are marked as primary and investigator-provided ranges exist, those are automatically set as primary. Otherwise, a validation error is raised if more than one is marked as primary.Test Constants and Test Coverage Updates:
primary
field for all score range test fixtures. [1] [2] [3] [4] [5] [6] [7] [8] [9]These changes improve data integrity for score range sets and expand support for calibration schemas.