fix: default option in attributes

This commit is contained in:
2025-11-03 10:43:10 +04:00
parent be878717e5
commit a7bda3d9f6
6 changed files with 24 additions and 21 deletions

View File

@ -68,13 +68,18 @@ class AttributeRepository(
) -> None:
attributes = await self._get_all_attributes_for_deal(project_id)
for attribute, module_id in attributes:
if attribute.default_value is None:
def_val = (
attribute.default_option_id
if attribute.default_option_id is not None
else attribute.default_value
)
if def_val is None:
continue
value = AttributeValue(
attribute_id=attribute.id,
deal_id=deal_id,
module_id=module_id,
value=attribute.default_value,
value=def_val,
)
self.session.add(value)