Skip to content
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

Closed

Conversation

Mohamed-Hacene
Copy link
Collaborator

No description provided.

Comment on lines +1523 to +1528
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()
Copy link
Contributor

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?

Copy link
Collaborator Author

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.

Copy link
Contributor

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.

@ab-smith ab-smith requested a review from eric-intuitem April 16, 2024 15:51
@github-actions github-actions bot locked and limited conversation to collaborators Apr 17, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants