Skip to content

Commit

Permalink
Allow for scoring main measures when there are submeasures. Closes #801.
Browse files Browse the repository at this point in the history
  • Loading branch information
fniessink committed Nov 27, 2023
1 parent 4b4e1f4 commit 2fef7d6
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 13 deletions.
4 changes: 2 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 4 additions & 0 deletions Content/Wijzigingsgeschiedenis.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
1 change: 0 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
docker-compose==1.29.2
pip==23.3.1
python-docx==1.1.0
python-pptx==0.6.23
Expand Down
24 changes: 14 additions & 10 deletions src/builder/xlsx_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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(":")
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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"})
6 changes: 6 additions & 0 deletions tests/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
"""Prepare the unit tests."""

import sys


sys.path.append("src")

0 comments on commit 2fef7d6

Please sign in to comment.