diff --git a/app/features/admin/services/module_compiler.py b/app/features/admin/services/module_compiler.py index 1ec643b..df8f4a3 100644 --- a/app/features/admin/services/module_compiler.py +++ b/app/features/admin/services/module_compiler.py @@ -1023,7 +1023,7 @@ class ModuleContentCompiler: "display_order": 0, }, { - "attribute_key": f"{template_code}.name", + "attribute_key": f"{template_code}.pattern_name", "empty_behavior": "hide", "visibility": "show", "display_order": 0, diff --git a/tests/test_module_builder.py b/tests/test_module_builder.py index df28a04..82c6612 100644 --- a/tests/test_module_builder.py +++ b/tests/test_module_builder.py @@ -500,6 +500,17 @@ async def test_module_content_compiler_full_pipeline(db_session: AsyncSession): det_tpl = json.loads(compiled_files[f"templates/{mod_code}_ct0005.json"]) validate_definition_document(det_tpl) validate_presentation_contracts(det_tpl) + det_def_codes = {d["code"] for d in det_tpl["attribute_defs"]} + det_pres_keys = [ + a["attribute_key"] + for c in det_tpl["presentation_contracts"] + for a in c["attributes"] + ] + assert f"{mod_code}_ct0005.pattern_name" in det_pres_keys + assert f"{mod_code}_ct0005.name" not in det_pres_keys + for key in det_pres_keys: + root_code = key.split(".", 2)[1] + assert root_code in det_def_codes, f"{key} missing from detail attribute_defs" # 6. Validate Data Documents with Seeder Validators validate_content_document(json.loads(compiled_files["data/list.json"]))