fix: default option in attributes
This commit is contained in:
@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user