add sanity checks for inventory to stop crashing
This commit is contained in:
parent
a7a68d2fe1
commit
c9ad415f13
@ -236,13 +236,25 @@ def gen_item_report():
|
|||||||
if "i" in inv.keys() and type(inv["i"]) == list and (int(inv["attr_t"]) == 0 or int(inv["attr_t"]) == 1):
|
if "i" in inv.keys() and type(inv["i"]) == list and (int(inv["attr_t"]) == 0 or int(inv["attr_t"]) == 1):
|
||||||
for item in inv["i"]:
|
for item in inv["i"]:
|
||||||
if item["attr_l"] in report_data:
|
if item["attr_l"] in report_data:
|
||||||
report_data[item["attr_l"]]["item_count"] = report_data[item["attr_l"]]["item_count"] + int(item["attr_c"])
|
if ("attr_c" in item):
|
||||||
|
report_data[item["attr_l"]]["item_count"] = report_data[item["attr_l"]]["item_count"] + int(item["attr_c"])
|
||||||
|
else:
|
||||||
|
report_data[item["attr_l"]]["item_count"] = report_data[item["attr_l"]]["item_count"] + 1
|
||||||
else:
|
else:
|
||||||
report_data[item["attr_l"]] = {"item_count": int(item["attr_c"]), "chars": {}}
|
if ("attr_c" in item):
|
||||||
|
report_data[item["attr_l"]] = {"item_count": int(item["attr_c"]), "chars": {}}
|
||||||
|
else:
|
||||||
|
report_data[item["attr_l"]] = {"item_count": 1, "chars": {}}
|
||||||
if name in report_data[item["attr_l"]]["chars"]:
|
if name in report_data[item["attr_l"]]["chars"]:
|
||||||
report_data[item["attr_l"]]["chars"][name] = report_data[item["attr_l"]]["chars"][name] + int(item["attr_c"])
|
if ("attr_c" in item):
|
||||||
|
report_data[item["attr_l"]]["chars"][name] = report_data[item["attr_l"]]["chars"][name] + int(item["attr_c"])
|
||||||
|
else:
|
||||||
|
report_data[item["attr_l"]]["chars"][name] = report_data[item["attr_l"]]["chars"][name] + 1
|
||||||
else:
|
else:
|
||||||
report_data[item["attr_l"]]["chars"][name] = int(item["attr_c"])
|
if ("attr_c" in item):
|
||||||
|
report_data[item["attr_l"]]["chars"][name] = int(item["attr_c"])
|
||||||
|
else:
|
||||||
|
report_data[item["attr_l"]]["chars"][name] = 1
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
current_app.logger.error(f"REPORT::ITEMS - ERROR PARSING CHARACTER {char_xml.id}")
|
current_app.logger.error(f"REPORT::ITEMS - ERROR PARSING CHARACTER {char_xml.id}")
|
||||||
current_app.logger.error(f"REPORT::ITEMS - {e}")
|
current_app.logger.error(f"REPORT::ITEMS - {e}")
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
data-placement="left"
|
data-placement="left"
|
||||||
title="{% include 'partials/charxml/_item_tooltip.html.j2' %}"
|
title="{% include 'partials/charxml/_item_tooltip.html.j2' %}"
|
||||||
>
|
>
|
||||||
{% if inv_item.attr_c != "1" %}
|
{% if 'attr_c' in inv_item %}
|
||||||
<span class="inventory-count text-bold">
|
<span class="inventory-count text-bold">
|
||||||
{%if inv_item.attr_c|int > 999 %}
|
{%if inv_item.attr_c|int > 999 %}
|
||||||
+999
|
+999
|
||||||
|
@ -66,7 +66,8 @@
|
|||||||
{% endwith %}
|
{% endwith %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{%if inv_item.attr_c|int > 999 %}
|
{% if 'attr_c' in inv_item %}
|
||||||
<br />Count: {{ inv_item.attr_c|numberFormat }}
|
{%if inv_item.attr_c|int > 999 %}
|
||||||
|
<br />Count: {{ inv_item.attr_c|numberFormat }}
|
||||||
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user