Skip to content

Commit aa24fdf

Browse files
bugfix draw function for modules (#344)
* fix draw function for modules to read only modules * add warning for multiple modules
1 parent dc490c8 commit aa24fdf

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/extensions/score_draw_uml_funcs/helpers.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,14 @@ def get_module(component: str, all_needs: dict[str, dict[str, str]]) -> str:
127127
need = all_needs.get(component, {})
128128

129129
if need:
130-
module = need.get("includes_back", "")
130+
# includes_back could deliver multiple needs; only return Modules
131+
parents = need.get("includes_back", [])
132+
module = [pid for pid in parents if all_needs.get(pid, {}).get("type") == "mod"]
133+
134+
if len(module) > 1:
135+
logger.warning(
136+
f"{component}: included in multiple modules: {module}. Returning first."
137+
)
131138

132139
if module:
133140
return module[0]

0 commit comments

Comments
 (0)