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

Fix #2002 remove degrees and course types from contributor export header #2045

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions evap/contributor/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,7 @@ def export_contributor_results(contributor):
include_not_enough_voters=True,
include_unpublished=False,
contributor=contributor,
verbose_heading=False,
)
return response

Expand Down
22 changes: 16 additions & 6 deletions evap/results/exporters.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@
return evaluations_with_results, used_questionnaires, course_results_exist

def write_headings_and_evaluation_info(
self, evaluations_with_results, semesters, contributor, degrees, course_types
self, evaluations_with_results, semesters, contributor, degrees, course_types, verbose_heading
):
export_name = "Evaluation"
if contributor:
Expand All @@ -169,9 +169,13 @@
export_name += f"\n{semesters[0].name}"
degree_names = [degree.name for degree in Degree.objects.filter(pk__in=degrees)]
course_type_names = [course_type.name for course_type in CourseType.objects.filter(pk__in=course_types)]
self.write_cell(
_("{}\n\n{}\n\n{}").format(export_name, ", ".join(degree_names), ", ".join(course_type_names)), "headline"
)
if verbose_heading:
self.write_cell(

Check warning on line 173 in evap/results/exporters.py

View check run for this annotation

Codecov / codecov/patch

evap/results/exporters.py#L173

Added line #L173 was not covered by tests
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The two paths here are not tested. Testing this should be relatively simple, can you add a small test for the two different headers? (Either at the view level by using two views that use the exporter here, or directly testing the exporter. Not quire sure which makes more sense, it feels like the view level would be a bit more stable)

_("{}\n\n{}\n\n{}").format(export_name, ", ".join(degree_names), ", ".join(course_type_names)),
"headline",
)
else:
self.write_cell(_("{}\n\n\n\n").format(export_name), "headline")

Check warning on line 178 in evap/results/exporters.py

View check run for this annotation

Codecov / codecov/patch

evap/results/exporters.py#L178

Added line #L178 was not covered by tests

for evaluation, __ in evaluations_with_results:
title = evaluation.full_name
Expand Down Expand Up @@ -285,7 +289,13 @@

# pylint: disable=arguments-differ
def export_impl(
self, semesters, selection_list, include_not_enough_voters=False, include_unpublished=False, contributor=None
self,
semesters,
selection_list,
include_not_enough_voters=False,
include_unpublished=False,
contributor=None,
verbose_heading=True,
):
# We want to throw early here, since workbook.save() will throw an IndexError otherwise.
assert len(selection_list) > 0
Expand All @@ -309,7 +319,7 @@
)

self.write_headings_and_evaluation_info(
evaluations_with_results, semesters, contributor, degrees, course_types
evaluations_with_results, semesters, contributor, degrees, course_types, verbose_heading
)

for questionnaire in used_questionnaires:
Expand Down