From 1fc6ee20a45c24ff29805cbb5afbc91c89c539d5 Mon Sep 17 00:00:00 2001 From: Tillbtn Date: Mon, 23 Oct 2023 20:17:53 +0200 Subject: [PATCH 1/2] don't use verbose_heading in contributor_export --- evap/contributor/views.py | 1 + evap/results/exporters.py | 22 ++++++++++++++++------ 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/evap/contributor/views.py b/evap/contributor/views.py index 842d1a28b6..3a0f463b46 100644 --- a/evap/contributor/views.py +++ b/evap/contributor/views.py @@ -288,6 +288,7 @@ def export_contributor_results(contributor): include_not_enough_voters=True, include_unpublished=False, contributor=contributor, + verbose_heading=False, ) return response diff --git a/evap/results/exporters.py b/evap/results/exporters.py index 2cce248693..b8d15455be 100644 --- a/evap/results/exporters.py +++ b/evap/results/exporters.py @@ -160,7 +160,7 @@ def filter_evaluations(semesters, evaluation_states, degrees, course_types, cont 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=True ): export_name = "Evaluation" if contributor: @@ -169,9 +169,13 @@ def write_headings_and_evaluation_info( 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( + _("{}\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") for evaluation, __ in evaluations_with_results: title = evaluation.full_name @@ -285,7 +289,13 @@ def write_questionnaire(self, questionnaire, evaluations_with_results, contribut # 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 @@ -309,7 +319,7 @@ def export_impl( ) 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: From 690556f8c3d117f76944f3a7e5fad4aa5935ac29 Mon Sep 17 00:00:00 2001 From: Tillbtn Date: Mon, 23 Oct 2023 20:53:28 +0200 Subject: [PATCH 2/2] fix merge issue --- evap/results/exporters.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/evap/results/exporters.py b/evap/results/exporters.py index b8d15455be..7df05d4ec0 100644 --- a/evap/results/exporters.py +++ b/evap/results/exporters.py @@ -160,7 +160,7 @@ def filter_evaluations(semesters, evaluation_states, degrees, course_types, cont return evaluations_with_results, used_questionnaires, course_results_exist def write_headings_and_evaluation_info( - self, evaluations_with_results, semesters, contributor, degrees, course_types, verbose_heading=True + self, evaluations_with_results, semesters, contributor, degrees, course_types, verbose_heading ): export_name = "Evaluation" if contributor: