-
Notifications
You must be signed in to change notification settings - Fork 256
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ca 178 add score notion to compliance assessment #267
Ca 178 add score notion to compliance assessment #267
Conversation
def get_score_choices(self): | ||
return [(i, i) for i in range(self.compliance_assessment.framework.min_score, self.compliance_assessment.framework.max_score + 1)] | ||
|
||
def __init__(self, *args, **kwargs): | ||
super().__init__(*args, **kwargs) | ||
self._meta.get_field('score').choices = self.get_score_choices() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the point of getting score choices if they are just a range of integers between min_score and max_score?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It permits to be consistent on the API, to be sure we can only add a score in the range of min_score and max_score.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could be done at the validation stage. This way you would only have to check the boundaries instead of iterating over every single integer contained between min_score and max_score.
No description provided.