From 2fef7d6d9300be74e3e8dac82788df4246d56d76 Mon Sep 17 00:00:00 2001 From: Frank Niessink Date: Wed, 15 Nov 2023 17:23:02 +0100 Subject: [PATCH] Allow for scoring main measures when there are submeasures. Closes #801. --- .circleci/config.yml | 4 ++-- Content/Wijzigingsgeschiedenis.md | 4 ++++ requirements.txt | 1 - src/builder/xlsx_builder.py | 24 ++++++++++++++---------- tests/__init__.py | 6 ++++++ 5 files changed, 26 insertions(+), 13 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index e647616e..37eb91a6 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -2,11 +2,11 @@ version: 2 jobs: build: machine: - image: ubuntu-2004:current + image: ubuntu-2204:2023.10.1 parallelism: 1 steps: - checkout - run: - docker-compose up + docker compose up - store_artifacts: path: docs/wip diff --git a/Content/Wijzigingsgeschiedenis.md b/Content/Wijzigingsgeschiedenis.md index f97d10ba..612f7232 100644 --- a/Content/Wijzigingsgeschiedenis.md +++ b/Content/Wijzigingsgeschiedenis.md @@ -27,6 +27,10 @@ * De tekst over kwaliteitsnormen uit paragraaf 3.1.4 ondergebracht in een nieuwe paragraaf 3.1.5 "Behalen van kwaliteitsnormen". * Koppeling tussen Use cases, Logische testgevallen, User stories en Epics minder strikt gemaakt in bijlage D "Gebruik van Jira". +#### Self-assessment checklist + +* Maak het mogelijk bij maatregelen met submaatregelen ook de hoofdmaatregel te scoren. + #### Alle documenten * De term "DevOps-werkwijze" vervangen door "operationeel beheer" of door "operationeel en/of applicatiebeheer" op de plekken waar het gaat over de dienstverlening en niet zozeer over de aanpak. diff --git a/requirements.txt b/requirements.txt index 670be700..715f6c72 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,3 @@ -docker-compose==1.29.2 pip==23.3.1 python-docx==1.1.0 python-pptx==0.6.23 diff --git a/src/builder/xlsx_builder.py b/src/builder/xlsx_builder.py index 7783f640..3f6d7511 100644 --- a/src/builder/xlsx_builder.py +++ b/src/builder/xlsx_builder.py @@ -53,7 +53,7 @@ def start_element(self, tag: str, attributes: TreeBuilderAttributes) -> None: super().start_element(tag, attributes) if tag == xmltags.DOCUMENT: self.__create_checklist(str(attributes["version"])) - elif tag == xmltags.MEASURE and not self.in_element(xmltags.SECTION, {xmltags.SECTION_IS_APPENDIX: "y"}): + elif tag == xmltags.MEASURE and not self.__in_appendix(): if self.last_level_1_section_heading: self.row += 1 self.checklist.merge_range( @@ -77,9 +77,7 @@ def text(self, tag: str, text: str, attributes: TreeBuilderAttributes) -> None: text = re.sub("[¹²³⁴⁵⁶⁷⁸⁹⁰]+", "", text) # Remove footnotes if tag == xmltags.HEADING and self.nr_elements(xmltags.SECTION) == 1: self.last_level_1_section_heading = text - elif self.in_element(xmltags.MEASURE) and not self.in_element( - xmltags.SECTION, {xmltags.SECTION_IS_APPENDIX: "y"} - ): + elif self.in_element(xmltags.MEASURE) and not self.__in_appendix(): if tag == xmltags.BOLD: self.measure_row = self.row self.measure_id, measure_title = text.split(":") @@ -110,15 +108,17 @@ def __write_measure( ) -> None: """Write a measure row.""" measure_format_key = "submeasure" if submeasure else "measure" + status_format_key = "substatus" if submeasure else "status" self.checklist.write(self.row, self.MEASURE_ID_COLUMN, measure_id, self.formats[measure_format_key]) self.checklist.write(self.row, self.MEASURE_COLUMN, measure_text, self.formats[measure_format_key]) + self.__write_assessment_choices(self.row, self.STATUS_COLUMN) if has_submeasures: - self.checklist.write(self.row, self.STATUS_COLUMN, "", self.formats[measure_format_key]) - self.checklist.write_comment(self.row, self.STATUS_COLUMN, "Bepaal a.u.b. de status per submaatregel") - else: - status_format_key = "substatus" if submeasure else "status" - self.checklist.write(self.row, self.STATUS_COLUMN, "", self.formats[status_format_key]) - self.__write_assessment_choices(self.row, self.STATUS_COLUMN) + self.checklist.write_comment( + self.row, + self.STATUS_COLUMN, + "Tip: bepaal eerst de status per submaatregel en daarna de status van de hoofdmaatregel." + ) + self.checklist.write(self.row, self.STATUS_COLUMN, "", self.formats[status_format_key]) self.checklist.write(self.row, self.EXPLANATION_COLUMN, "", self.formats["explanation"]) def end_element(self, tag: str, attributes: TreeBuilderAttributes) -> None: @@ -224,3 +224,7 @@ def __create_action_list(self) -> None: for column, (header, width) in enumerate([("Datum", 12), ("Actie", 70), ("Status", 20), ("Toelichting", 70)]): action_list.write(1, column, header, self.formats["header"]) action_list.set_column(f"{'ABCD'[column]}:{'ABCD'[column]}", width) + + def __in_appendix(self) -> bool: + """Return whether the current section is in an appendix.""" + return self.in_element(xmltags.SECTION, {xmltags.SECTION_IS_APPENDIX: "y"}) diff --git a/tests/__init__.py b/tests/__init__.py index e69de29b..5fd2714a 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -0,0 +1,6 @@ +"""Prepare the unit tests.""" + +import sys + + +sys.path.append("src")