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 15, 2023
1 parent 2f0319b commit 727ba28
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 7 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
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
10 changes: 6 additions & 4 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 @@ -224,3 +222,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 727ba28

Please sign in to comment.