mirror of
https://github.com/DarkflameUniverse/NexusDashboard.git
synced 2024-11-12 21:08:20 +00:00
Merge branch 'main' into issue-31
This commit is contained in:
commit
200370709c
@ -30,14 +30,20 @@ def approve_name(id, action):
|
||||
character = CharacterInfo.query.filter(CharacterInfo.id == id).first()
|
||||
|
||||
if action == "approve":
|
||||
log_audit(f"Approved ({character.id}){character.pending_name} from {character.name}")
|
||||
flash(
|
||||
f"Approved ({character.id}){character.pending_name} from {character.name}",
|
||||
"success"
|
||||
)
|
||||
if character.pending_name:
|
||||
character.name = character.pending_name
|
||||
character.pending_name = ""
|
||||
log_audit(f"Approved ({character.id}){character.pending_name} from {character.name}")
|
||||
flash(
|
||||
f"Approved ({character.id}){character.pending_name} from {character.name}",
|
||||
"success"
|
||||
)
|
||||
else:
|
||||
log_audit("Cannot make character name empty")
|
||||
flash(
|
||||
"Cannot make character name empty",
|
||||
"danger"
|
||||
)
|
||||
character.needs_rename = False
|
||||
|
||||
elif action == "rename":
|
||||
|
@ -282,7 +282,9 @@ def register_luclient_jinja_helpers(app):
|
||||
'select component_id from ComponentsRegistry where component_type = 11 and id = ?',
|
||||
[lot_id],
|
||||
one=True
|
||||
)[0]
|
||||
)
|
||||
if render_component_id:
|
||||
render_component_id = render_component_id[0]
|
||||
|
||||
rarity = query_cdclient(
|
||||
'select rarity from ItemComponent where id = ?',
|
||||
|
@ -114,7 +114,7 @@ class PlayKey(db.Model):
|
||||
)
|
||||
db.session.add(new_key)
|
||||
db.session.commit()
|
||||
return key
|
||||
return key
|
||||
|
||||
def delete(self):
|
||||
db.session.delete(self)
|
||||
|
@ -6,7 +6,6 @@ from app import gm_level, scheduler
|
||||
from sqlalchemy.orm import load_only
|
||||
import datetime
|
||||
import xmltodict
|
||||
import random
|
||||
|
||||
reports_blueprint = Blueprint('reports', __name__)
|
||||
|
||||
@ -32,7 +31,6 @@ def index():
|
||||
).filter(
|
||||
Reports.report_type == "uscore"
|
||||
).group_by(Reports.date).options(load_only(Reports.date)).all()
|
||||
|
||||
return render_template(
|
||||
'reports/index.html.j2',
|
||||
reports_items=reports_items,
|
||||
@ -69,20 +67,24 @@ def items_graph(start, end):
|
||||
items[key] = get_lot_name(key)
|
||||
# make it
|
||||
for key, value in items.items():
|
||||
data = []
|
||||
for entry in entries:
|
||||
if key in entry.data.keys():
|
||||
data.append(entry.data[key])
|
||||
else:
|
||||
data.append(0)
|
||||
color = "#" + value.encode("utf-8").hex()[1:7]
|
||||
if max(data) > 10:
|
||||
datasets.append({
|
||||
"label": value,
|
||||
"data": data,
|
||||
"backgroundColor": color,
|
||||
"borderColor": color
|
||||
})
|
||||
if value:
|
||||
data = []
|
||||
for entry in entries:
|
||||
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])
|
||||
else:
|
||||
data.append(0)
|
||||
color = "#" + value.encode("utf-8").hex()[1:7]
|
||||
if max(data) > 10:
|
||||
datasets.append({
|
||||
"label": value,
|
||||
"data": data,
|
||||
"backgroundColor": color,
|
||||
"borderColor": color
|
||||
})
|
||||
|
||||
return render_template(
|
||||
'reports/graph.html.j2',
|
||||
@ -224,6 +226,7 @@ def gen_item_report():
|
||||
report_data = {}
|
||||
|
||||
for char_xml in char_xmls:
|
||||
name = CharacterInfo.query.filter(CharacterInfo.id == char_xml.id).first().name
|
||||
try:
|
||||
character_json = xmltodict.parse(
|
||||
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):
|
||||
for item in inv["i"]:
|
||||
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:
|
||||
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:
|
||||
current_app.logger.error(f"REPORT::ITEMS - ERROR PARSING CHARACTER {char_xml.id}")
|
||||
current_app.logger.error(f"REPORT::ITEMS - {e}")
|
||||
|
@ -20,18 +20,34 @@
|
||||
<th scope="col">
|
||||
Count
|
||||
</th>
|
||||
<th scope="col">
|
||||
Breakdown
|
||||
</th>
|
||||
<th scope="col">
|
||||
Rarity
|
||||
</th>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for lot, count in data.items() %}
|
||||
{% for lot, details in data.items() %}
|
||||
<tr>
|
||||
<td>
|
||||
{{ lot|get_lot_name }}
|
||||
</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>
|
||||
{{ lot|get_lot_rarity }}
|
||||
|
Loading…
Reference in New Issue
Block a user