Skip to content

Commit eb8cc41

Browse files
committed
generator: make sure to generate section in order
Widget generation may require information from previous section, like the presence or not of the gender fields, so we need to parse each section in the order they are expected to appear.
1 parent b3d4060 commit eb8cc41

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

packages/evolution-generator/src/scripts/generate_widgets.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,15 @@ def generate_widgets(excel_file_path: str, widgets_output_folder: str):
102102

103103
# Find the index of 'section' in headers
104104
section_index = headers.index("section")
105-
# Get all unique section names
106-
section_names = set(row[section_index].value for row in rows[1:])
105+
106+
# Get all unique section names while preserving order from the section sheet
107+
seen_sections: set[str] = set()
108+
section_names: list[str] = []
109+
for row in rows[1:]:
110+
section = row[section_index].value
111+
if section and section not in seen_sections:
112+
seen_sections.add(section)
113+
section_names.append(section)
107114

108115
# Track gender-related fields. It will be done one section at a time, so
109116
# it's not possible to use gender field in a section before it is

0 commit comments

Comments
 (0)