fix edge cases in report generation
with xml parsing error > system disable email by default
This commit is contained in:
parent
9452e8c801
commit
039b45c824
@ -50,7 +50,7 @@ def init_accounts():
|
|||||||
@click.argument('player')
|
@click.argument('player')
|
||||||
@with_appcontext
|
@with_appcontext
|
||||||
def load_property(zone, player):
|
def load_property(zone, player):
|
||||||
|
"""shoves property data into db"""
|
||||||
char = CharacterInfo.query.filter(CharacterInfo.name == player).first()
|
char = CharacterInfo.query.filter(CharacterInfo.name == player).first()
|
||||||
if not char:
|
if not char:
|
||||||
print("Character not Found")
|
print("Character not Found")
|
||||||
@ -97,6 +97,7 @@ def load_property(zone, player):
|
|||||||
|
|
||||||
@click.command("gen_image_cache")
|
@click.command("gen_image_cache")
|
||||||
def gen_image_cache():
|
def gen_image_cache():
|
||||||
|
"""generates image cache"""
|
||||||
luclient = pathlib.Path('app/luclient/res')
|
luclient = pathlib.Path('app/luclient/res')
|
||||||
files = [path for path in luclient.rglob("*.dds") if path.is_file()]
|
files = [path for path in luclient.rglob("*.dds") if path.is_file()]
|
||||||
|
|
||||||
@ -114,6 +115,7 @@ def gen_image_cache():
|
|||||||
|
|
||||||
@click.command("gen_model_cache")
|
@click.command("gen_model_cache")
|
||||||
def gen_model_cache():
|
def gen_model_cache():
|
||||||
|
"""generate model obj cache"""
|
||||||
luclient = pathlib.Path('app/luclient/res')
|
luclient = pathlib.Path('app/luclient/res')
|
||||||
files = [path for path in luclient.rglob("*.lxfml") if path.is_file()]
|
files = [path for path in luclient.rglob("*.lxfml") if path.is_file()]
|
||||||
pool = Pool(processes=4)
|
pool = Pool(processes=4)
|
||||||
@ -135,6 +137,7 @@ def convert_lxfml_to_obj(file, lod):
|
|||||||
return
|
return
|
||||||
|
|
||||||
def get_cache_file(path):
|
def get_cache_file(path):
|
||||||
|
"""helper"""
|
||||||
# convert to list so that we can change elements
|
# convert to list so that we can change elements
|
||||||
parts = list(path.parts)
|
parts = list(path.parts)
|
||||||
|
|
||||||
|
@ -21,12 +21,12 @@ def command():
|
|||||||
return render_template('logs/command.html.j2')
|
return render_template('logs/command.html.j2')
|
||||||
|
|
||||||
|
|
||||||
@log_blueprint.route('/errors')
|
@log_blueprint.route('/system')
|
||||||
@gm_level(8)
|
@gm_level(8)
|
||||||
def error():
|
def system():
|
||||||
with open('nexus_dashboard.log', 'r') as file:
|
with open('nexus_dashboard.log', 'r') as file:
|
||||||
logs = '</br>'.join(file.read().split('\n')[-100:])
|
logs = '</br>'.join(file.read().split('\n')[-100:])
|
||||||
return render_template('logs/error.html.j2', logs=logs)
|
return render_template('logs/system.html.j2', logs=logs)
|
||||||
|
|
||||||
|
|
||||||
@log_blueprint.route('/audits')
|
@log_blueprint.route('/audits')
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
from flask import render_template, Blueprint, redirect, url_for, request, abort, flash, current_app
|
from flask import render_template, Blueprint, redirect, url_for, request, flash, current_app
|
||||||
from flask_user import login_required
|
from flask_user import login_required
|
||||||
from app.models import PetNames, db, CharacterXML, CharacterInfo
|
from app.models import PetNames, db, CharacterXML, CharacterInfo
|
||||||
from datatables import ColumnDT, DataTables
|
from datatables import ColumnDT, DataTables
|
||||||
@ -126,7 +126,7 @@ def get_pets(status="all"):
|
|||||||
return data
|
return data
|
||||||
|
|
||||||
|
|
||||||
@scheduler.task("cron", id="pet_name_maintenance", second="*", timezone="UTC")
|
@scheduler.task("cron", id="pet_name_maintenance", hour="*", timezone="UTC")
|
||||||
def pet_name_maintenance():
|
def pet_name_maintenance():
|
||||||
with scheduler.app.app_context():
|
with scheduler.app.app_context():
|
||||||
# associate pet names to characters
|
# associate pet names to characters
|
||||||
|
@ -60,17 +60,21 @@ def gen_item_report():
|
|||||||
report_data={}
|
report_data={}
|
||||||
|
|
||||||
for char_xml in char_xmls:
|
for char_xml in char_xmls:
|
||||||
character_json = xmltodict.parse(
|
try:
|
||||||
char_xml.xml_data,
|
character_json = xmltodict.parse(
|
||||||
attr_prefix="attr_"
|
char_xml.xml_data,
|
||||||
)
|
attr_prefix="attr_"
|
||||||
for inv in character_json["obj"]["inv"]["items"]["in"]:
|
)
|
||||||
if "i" in inv.keys() and type(inv["i"]) == list and (int(inv["attr_t"])==0 or int(inv["attr_t"])==0):
|
for inv in character_json["obj"]["inv"]["items"]["in"]:
|
||||||
for item in inv["i"]:
|
if "i" in inv.keys() and type(inv["i"]) == list and (int(inv["attr_t"])==0 or int(inv["attr_t"])==0):
|
||||||
if item["attr_l"] in report_data:
|
for item in inv["i"]:
|
||||||
report_data[item["attr_l"]] = report_data[item["attr_l"]] + int(item["attr_c"])
|
if item["attr_l"] in report_data:
|
||||||
else:
|
report_data[item["attr_l"]] = report_data[item["attr_l"]] + int(item["attr_c"])
|
||||||
report_data[item["attr_l"]] = int(item["attr_c"])
|
else:
|
||||||
|
report_data[item["attr_l"]] = 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}")
|
||||||
|
|
||||||
new_report = Reports(
|
new_report = Reports(
|
||||||
data=report_data,
|
data=report_data,
|
||||||
@ -110,11 +114,15 @@ def gen_currency_report():
|
|||||||
report_data={}
|
report_data={}
|
||||||
|
|
||||||
for character in characters:
|
for character in characters:
|
||||||
character_json = xmltodict.parse(
|
try:
|
||||||
character.xml_data,
|
character_json = xmltodict.parse(
|
||||||
attr_prefix="attr_"
|
character.xml_data,
|
||||||
)
|
attr_prefix="attr_"
|
||||||
report_data[CharacterInfo.query.filter(CharacterInfo.id==character.id).first().name] = int(character_json["obj"]["char"]["attr_cc"])
|
)
|
||||||
|
report_data[CharacterInfo.query.filter(CharacterInfo.id==character.id).first().name] = int(character_json["obj"]["char"]["attr_cc"])
|
||||||
|
except Exception as e:
|
||||||
|
current_app.logger.error(f"REPORT::CURRENCY - ERROR PARSING CHARACTER {char_xml.id}")
|
||||||
|
current_app.logger.error(f"REPORT::CURRENCY - {e}")
|
||||||
|
|
||||||
new_report = Reports(
|
new_report = Reports(
|
||||||
data=report_data,
|
data=report_data,
|
||||||
@ -154,11 +162,15 @@ def gen_uscore_report():
|
|||||||
report_data={}
|
report_data={}
|
||||||
|
|
||||||
for character in characters:
|
for character in characters:
|
||||||
character_json = xmltodict.parse(
|
try:
|
||||||
character.xml_data,
|
character_json = xmltodict.parse(
|
||||||
attr_prefix="attr_"
|
character.xml_data,
|
||||||
)
|
attr_prefix="attr_"
|
||||||
report_data[CharacterInfo.query.filter(CharacterInfo.id==character.id).first().name] = int(character_json["obj"]["char"]["attr_ls"])
|
)
|
||||||
|
report_data[CharacterInfo.query.filter(CharacterInfo.id==character.id).first().name] = int(character_json["obj"]["char"]["attr_ls"])
|
||||||
|
except Exception as e:
|
||||||
|
current_app.logger.error(f"REPORT::U-SCORE - ERROR PARSING CHARACTER {char_xml.id}")
|
||||||
|
current_app.logger.error(f"REPORT::U-SCORE - {e}")
|
||||||
|
|
||||||
new_report = Reports(
|
new_report = Reports(
|
||||||
data=report_data,
|
data=report_data,
|
||||||
|
@ -25,7 +25,7 @@ USER_REQUIRE_RETYPE_PASSWORD = True # Prompt for `retype password`
|
|||||||
USER_ENABLE_USERNAME = True # Register and Login with username
|
USER_ENABLE_USERNAME = True # Register and Login with username
|
||||||
|
|
||||||
# Email Related Settings
|
# Email Related Settings
|
||||||
USER_ENABLE_EMAIL = True # Register with Email WILL - DISABLE OTHER THINGS TOO
|
USER_ENABLE_EMAIL = False # Register with Email WILL - DISABLE OTHER THINGS TOO
|
||||||
USER_ENABLE_CONFIRM_EMAIL = True # Force users to confirm their email
|
USER_ENABLE_CONFIRM_EMAIL = True # Force users to confirm their email
|
||||||
USER_ENABLE_INVITE_USER = False # Allow users to be invited
|
USER_ENABLE_INVITE_USER = False # Allow users to be invited
|
||||||
USER_REQUIRE_INVITATION = False # Only invited users may - WILL DISABLE REGISTRATION
|
USER_REQUIRE_INVITATION = False # Only invited users may - WILL DISABLE REGISTRATION
|
||||||
|
@ -69,14 +69,12 @@
|
|||||||
<a class="dropdown-item text-center" href='{{ url_for('log.activity') }}'>Command Log</a>
|
<a class="dropdown-item text-center" href='{{ url_for('log.activity') }}'>Command Log</a>
|
||||||
<a class="dropdown-item text-center" href='{{ url_for('log.command') }}'>Activity Log</a>
|
<a class="dropdown-item text-center" href='{{ url_for('log.command') }}'>Activity Log</a>
|
||||||
<a class="dropdown-item text-center" href='{{ url_for('log.audit') }}'>Audit Log</a>
|
<a class="dropdown-item text-center" href='{{ url_for('log.audit') }}'>Audit Log</a>
|
||||||
<a class="dropdown-item text-center" href='{{ url_for('log.error') }}'>Error Log</a>
|
<a class="dropdown-item text-center" href='{{ url_for('log.system') }}'>System Log</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{% if current_user.is_authenticated and current_user.gm_level == 9 and config.REQUIRE_PLAY_KEY %}
|
{% if current_user.is_authenticated and current_user.gm_level == 9 and config.REQUIRE_PLAY_KEY %}
|
||||||
{# Play Keys #}
|
{# Play Keys #}
|
||||||
<a id='play_keys-index' class='nav-link' href='{{ url_for('play_keys.index') }}'>Play Keys</a>
|
<a id='play_keys-index' class='nav-link' href='{{ url_for('play_keys.index') }}'>Play Keys</a>
|
||||||
|
Loading…
Reference in New Issue
Block a user