Skip to content

Add validation for the type of AssessmentItem objects - #4888

Merged
rtibbles merged 2 commits into
learningequality:unstablefrom
drona-gyawali:feature-update
Feb 11, 2025
Merged

rtibbles merged 2 commits into
learningequality:unstablefrom
drona-gyawali:feature-update

Conversation

@drona-gyawali

Copy link
Copy Markdown
Contributor

Summary

  • Added choices to the type field of the AssessmentItem model to restrict it to valid question_choices defined in le_utils.constants.exercises.question_choices.

  • Updated the default value from "mutiplechoices" to "Mutiple Selection" to align with expected behavior.

Why these changes ?

Previously, there was no validation on AssessmentItem.type object, which could lead to invalid or unsupported question types. By adding choices, we ensure that only acceptable types recognized by Studio and Kolibri are allowed.

References

Comment thread contentcuration/contentcuration/models.py Outdated

@akolson akolson left a comment

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.

Hi @drona-gyawali. Great work on this! Just a minor tweak and we should be good to go. Also more importantly, remember to re-run the migrations as the the model has changed -- please commit them too. Thanks

@drona-gyawali

Copy link
Copy Markdown
Contributor Author

Greetings @akolson, @rtibbles I have made the requested changes. Please review my work and let me know if any further modifications are needed.

@akolson akolson left a comment

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.

LGTM! Thanks @drona-gyawali for the changes.

@rtibbles rtibbles self-assigned this Feb 11, 2025
@rtibbles
rtibbles merged commit 05274cd into learningequality:unstable Feb 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add validation for the "type" of AssessmentItem objects

4 participants