mirror of
https://github.com/DarkflameUniverse/NexusDashboard.git
synced 2024-11-13 21:38:20 +00:00
parent
b561bcb60d
commit
c1307af49c
@ -308,7 +308,9 @@ def register_luclient_jinja_helpers(app):
|
|||||||
'select component_id from ComponentsRegistry where component_type = 11 and id = ?',
|
'select component_id from ComponentsRegistry where component_type = 11 and id = ?',
|
||||||
[lot_id],
|
[lot_id],
|
||||||
one=True
|
one=True
|
||||||
)[0]
|
)
|
||||||
|
if render_component_id:
|
||||||
|
render_component_id = render_component_id[0]
|
||||||
|
|
||||||
rarity = query_cdclient(
|
rarity = query_cdclient(
|
||||||
'select rarity from ItemComponent where id = ?',
|
'select rarity from ItemComponent where id = ?',
|
||||||
|
@ -6,7 +6,6 @@ from app import gm_level, scheduler
|
|||||||
from sqlalchemy.orm import load_only
|
from sqlalchemy.orm import load_only
|
||||||
import datetime
|
import datetime
|
||||||
import xmltodict
|
import xmltodict
|
||||||
import random
|
|
||||||
|
|
||||||
reports_blueprint = Blueprint('reports', __name__)
|
reports_blueprint = Blueprint('reports', __name__)
|
||||||
|
|
||||||
@ -32,7 +31,6 @@ def index():
|
|||||||
).filter(
|
).filter(
|
||||||
Reports.report_type == "uscore"
|
Reports.report_type == "uscore"
|
||||||
).group_by(Reports.date).options(load_only(Reports.date)).all()
|
).group_by(Reports.date).options(load_only(Reports.date)).all()
|
||||||
|
|
||||||
return render_template(
|
return render_template(
|
||||||
'reports/index.html.j2',
|
'reports/index.html.j2',
|
||||||
reports_items=reports_items,
|
reports_items=reports_items,
|
||||||
@ -69,9 +67,13 @@ def items_graph(start, end):
|
|||||||
items[key] = get_lot_name(key)
|
items[key] = get_lot_name(key)
|
||||||
# make it
|
# make it
|
||||||
for key, value in items.items():
|
for key, value in items.items():
|
||||||
|
if value:
|
||||||
data = []
|
data = []
|
||||||
for entry in entries:
|
for entry in entries:
|
||||||
if key in entry.data.keys():
|
if key in entry.data.keys():
|
||||||
|
if not isinstance(entry.data[key], int):
|
||||||
|
data.append(entry.data[key]["item_count"])
|
||||||
|
else:
|
||||||
data.append(entry.data[key])
|
data.append(entry.data[key])
|
||||||
else:
|
else:
|
||||||
data.append(0)
|
data.append(0)
|
||||||
@ -224,6 +226,7 @@ def gen_item_report():
|
|||||||
report_data = {}
|
report_data = {}
|
||||||
|
|
||||||
for char_xml in char_xmls:
|
for char_xml in char_xmls:
|
||||||
|
name = CharacterInfo.query.filter(CharacterInfo.id == char_xml.id).first().name
|
||||||
try:
|
try:
|
||||||
character_json = xmltodict.parse(
|
character_json = xmltodict.parse(
|
||||||
char_xml.xml_data,
|
char_xml.xml_data,
|
||||||
@ -233,9 +236,13 @@ 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"]] = report_data[item["attr_l"]] + int(item["attr_c"])
|
report_data[item["attr_l"]]["item_count"] = report_data[item["attr_l"]]["item_count"] + int(item["attr_c"])
|
||||||
else:
|
else:
|
||||||
report_data[item["attr_l"]] = int(item["attr_c"])
|
report_data[item["attr_l"]] = {"item_count": int(item["attr_c"]), "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"])
|
||||||
|
else:
|
||||||
|
report_data[item["attr_l"]]["chars"][name] = int(item["attr_c"])
|
||||||
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}")
|
||||||
|
@ -20,18 +20,34 @@
|
|||||||
<th scope="col">
|
<th scope="col">
|
||||||
Count
|
Count
|
||||||
</th>
|
</th>
|
||||||
|
<th scope="col">
|
||||||
|
Breakdown
|
||||||
|
</th>
|
||||||
<th scope="col">
|
<th scope="col">
|
||||||
Rarity
|
Rarity
|
||||||
</th>
|
</th>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
{% for lot, count in data.items() %}
|
{% for lot, details in data.items() %}
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
{{ lot|get_lot_name }}
|
{{ lot|get_lot_name }}
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
{{ count }}
|
{% if details.chars %}
|
||||||
|
{{ details.item_count }}
|
||||||
|
{% else %}
|
||||||
|
{{ details }}
|
||||||
|
{% endif %}
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
{% if details.chars %}
|
||||||
|
{% for char, value in details.chars|dictsort(false, 'value')|reverse %}
|
||||||
|
{{char}}: {{value}}<br/>
|
||||||
|
{% endfor %}
|
||||||
|
{% else %}
|
||||||
|
Missing
|
||||||
|
{% endif %}
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
{{ lot|get_lot_rarity }}
|
{{ lot|get_lot_rarity }}
|
||||||
|
Loading…
Reference in New Issue
Block a user