fix: avoid error when material type is unknown
not sure if this is a unique situation in my dev environment or what..but i keep encountering this in dev, so might as well add it. better safe than sorry
This commit is contained in:
parent
f48cf55963
commit
3bacb884dc
1 changed files with 3 additions and 1 deletions
|
|
@ -81,7 +81,9 @@ def render_quantity_object(quantity):
|
||||||
text = f"( {measure} ) {value} {unit}"
|
text = f"( {measure} ) {value} {unit}"
|
||||||
|
|
||||||
if quantity["quantity_type_id"] == "material":
|
if quantity["quantity_type_id"] == "material":
|
||||||
materials = ", ".join([mtype["name"] for mtype in quantity["material_types"]])
|
materials = ", ".join(
|
||||||
|
[mtype.get("name", "???") for mtype in quantity["material_types"]]
|
||||||
|
)
|
||||||
return f"{materials} {text}"
|
return f"{materials} {text}"
|
||||||
|
|
||||||
return text
|
return text
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue