Skip to content

Average grades in export [REBORN]#2708

Open
Belissimo-T wants to merge 26 commits into
e-valuation:mainfrom
Belissimo-T:feat/2001
Open

Average grades in export [REBORN]#2708
Belissimo-T wants to merge 26 commits into
e-valuation:mainfrom
Belissimo-T:feat/2001

Conversation

@Belissimo-T

Copy link
Copy Markdown
Collaborator

closes #2001

TODO: Tests

this does not cover several important details:

1. evaluations from previous semesters are included

2. evaluations from other programs and course types are included

3. only published evaluations are included
   a. even if the unpublished evaluations are part of the export

4. which contributions are used

5. we are averaging over the averages of several results

6. are results with not enough voters used

So this test should be extended / more tests should be added. I think it is very easy to mess up some of these details in the future and when that happens, these tests should catch it

@Belissimo-T Belissimo-T changed the title Average grades in export REBORN Average grades in export [REBORN] Apr 20, 2026
@janno42 janno42 requested a review from richardebeling April 27, 2026 17:49
Comment on lines +657 to +658
[course_program.id for course_program in evaluation_1.course.programs.all()]
+ [course_program.id for course_program in evaluation_2.course.programs.all()],

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.

This is just [program]? (or, if we want to test the duplication, [program, program])

binary_content.seek(0)
workbook = xlrd.open_workbook(file_contents=binary_content.read())

self.assertAlmostEqual(workbook.sheets()[0].row_values(5)[1], 1.5833333333333335)

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.

Please add a short comment explaining where this number comes from

Comment on lines +675 to +678
# average for second questionnaire must be the value from evaluation2 (since evaluation1 doesn't have the questionnaire)
self.assertEqual(float(workbook.sheets()[0].row_values(8)[1]), float(workbook.sheets()[0].row_values(8)[3]))
# average field next to the questionnaire title must be empty
self.assertEqual("", workbook.sheets()[0].row_values(8)[2])

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.

The discussions from #2366 (comment) still apply

Comment thread evap/results/tools.py
Comment on lines +124 to +132
def grade_average(self) -> float:
return (
sum(grade * count for count, grade in zip(self.counts, self.choices.grades, strict=True)) / self.count_sum
)

@property
def approval_average(self) -> float:
return self.approval_count / self.count_sum

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.

Is https://github.com/e-valuation/EvaP/wiki/Calculation-of-Results still up to date, or do we need to update anything there?

Comment thread evap/results/exporters.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Add averages to results exports

3 participants