mirror of
https://github.com/DarkflameUniverse/NexusDashboard.git
synced 2024-11-25 23:17:19 +00:00
added command to fix legacy property issues
This commit is contained in:
parent
f8d5928c86
commit
70aed00d97
@ -1,5 +1,5 @@
|
|||||||
import os
|
import os
|
||||||
from flask import Flask, url_for, g, redirect, render_template
|
from flask import Flask, url_for, g, redirect
|
||||||
from functools import wraps
|
from functools import wraps
|
||||||
from flask_assets import Environment
|
from flask_assets import Environment
|
||||||
from webassets import Bundle
|
from webassets import Bundle
|
||||||
@ -12,7 +12,14 @@ from flask_wtf.csrf import CSRFProtect
|
|||||||
from flask_apscheduler import APScheduler
|
from flask_apscheduler import APScheduler
|
||||||
from app.luclient import register_luclient_jinja_helpers
|
from app.luclient import register_luclient_jinja_helpers
|
||||||
|
|
||||||
from app.commands import init_db, init_accounts, load_property, gen_image_cache, gen_model_cache
|
from app.commands import (
|
||||||
|
init_db,
|
||||||
|
init_accounts,
|
||||||
|
load_property,
|
||||||
|
gen_image_cache,
|
||||||
|
gen_model_cache,
|
||||||
|
fix_clone_ids
|
||||||
|
)
|
||||||
from app.models import Account, AccountInvitation, AuditLog
|
from app.models import Account, AccountInvitation, AuditLog
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
@ -90,6 +97,7 @@ def create_app():
|
|||||||
app.cli.add_command(load_property)
|
app.cli.add_command(load_property)
|
||||||
app.cli.add_command(gen_image_cache)
|
app.cli.add_command(gen_image_cache)
|
||||||
app.cli.add_command(gen_model_cache)
|
app.cli.add_command(gen_model_cache)
|
||||||
|
app.cli.add_command(fix_clone_ids)
|
||||||
|
|
||||||
register_logging(app)
|
register_logging(app)
|
||||||
register_settings(app)
|
register_settings(app)
|
||||||
|
@ -47,6 +47,23 @@ def init_accounts():
|
|||||||
return
|
return
|
||||||
|
|
||||||
|
|
||||||
|
@click.command("fix_clone_ids")
|
||||||
|
@with_appcontext
|
||||||
|
def fix_clone_ids():
|
||||||
|
"""Fix incorrect prop_clone_id's"""
|
||||||
|
properties = Property.query.all()
|
||||||
|
count = 0
|
||||||
|
for prop in properties:
|
||||||
|
char = CharacterInfo.query.filter(CharacterInfo.id == prop.owner_id).first()
|
||||||
|
if char.prop_clone_id != prop.clone_id:
|
||||||
|
count += 1
|
||||||
|
prop.clone_id = char.prop_clone_id
|
||||||
|
prop.save()
|
||||||
|
|
||||||
|
print(f"Fixed {count} props")
|
||||||
|
return
|
||||||
|
|
||||||
|
|
||||||
@click.command("load_property")
|
@click.command("load_property")
|
||||||
@click.argument('zone')
|
@click.argument('zone')
|
||||||
@click.argument('player')
|
@click.argument('player')
|
||||||
|
Loading…
Reference in New Issue
Block a user