Skip to content

Commit

Permalink
Add score computer function.
Browse files Browse the repository at this point in the history
No-Issue

Signed-off-by: James Tanner <tanner.jc@gmail.com>
  • Loading branch information
jctanner committed Nov 13, 2023
1 parent a3b43e8 commit e7f8541
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions galaxy_ng/app/utils/survey.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
SURVEY_FIELDS = [
'docs',
'ease_of_use',
'does_what_it_says',
'works_as_is',
'used_in_production'
]


def calculate_survey_score(surveys):

answer_count = 0
survey_score = 0.0

for survey in surveys:
for k in SURVEY_FIELDS:
data = getattr(survey, k)
if data is not None:
answer_count += 1
survey_score += (data - 1) / 4

score = (survey_score / answer_count) * 5

return score

0 comments on commit e7f8541

Please sign in to comment.