Add property reputation handling

This commit is contained in:
Aaron Kimbre
2022-03-31 18:05:28 -05:00
parent 560afa5e0d
commit 7f992a5dfa
6 changed files with 90 additions and 13 deletions

View File

@@ -75,14 +75,14 @@ def create_app():
if cdclient is not None:
cdclient.close()
@app.errorhandler(Exception)
def handle_exception(e):
app.logger.error(e)
# pass through HTTP errors
if isinstance(e, HTTPException):
return e
# now you're handling non-HTTP exceptions only
return render_template("status_codes/500.html.j2", exception=e), 500
# @app.errorhandler(Exception)
# def handle_exception(e):
# app.logger.error(e)
# # pass through HTTP errors
# if isinstance(e, HTTPException):
# return e
# # now you're handling non-HTTP exceptions only
# return render_template("status_codes/500.html.j2", exception=e), 500
# add the commands to flask cli
app.cli.add_command(init_db)

View File

@@ -8,6 +8,7 @@ from flask_sqlalchemy import BaseQuery
from sqlalchemy.dialects import mysql
from sqlalchemy.exc import OperationalError, StatementError
from sqlalchemy.types import JSON
from sqlalchemy.ext.hybrid import hybrid_property
from time import sleep
import random
import string
@@ -694,6 +695,15 @@ class Property(db.Model):
nullable=False,
)
performance_cost = db.Column(
mysql.DOUBLE(
precision=20,
scale=15,
asdecimal=False
),
server_default='0.0'
)
zone_id = db.Column(
mysql.INTEGER,
nullable=False,

View File

@@ -123,8 +123,9 @@ def get(status="all"):
ColumnDT(Property.time_claimed), # 9
ColumnDT(Property.rejection_reason), # 10
ColumnDT(Property.reputation), # 11
ColumnDT(Property.zone_id), # 12
ColumnDT(Account.username) # 13
ColumnDT(Property.performance_cost), # 12
ColumnDT(Property.zone_id), # 13
ColumnDT(Account.username) # 14
]
query = None
@@ -146,6 +147,7 @@ def get(status="all"):
rowTable = DataTables(params, query, columns)
data = rowTable.output_result()
print(data)
for property_data in data["data"]:
id = property_data["0"]
@@ -181,7 +183,7 @@ def get(status="all"):
if property_data["4"] == "":
property_data["4"] = query_cdclient(
'select DisplayDescription from ZoneTable where zoneID = ?',
[property_data["12"]],
[property_data["13"]],
one=True
)
@@ -200,9 +202,9 @@ def get(status="all"):
else:
property_data["7"] = '''<h2 class="far fa-check-square text-success"></h2>'''
property_data["12"] = query_cdclient(
property_data["13"] = query_cdclient(
'select DisplayDescription from ZoneTable where zoneID = ?',
[property_data["12"]],
[property_data["13"]],
one=True
)

View File

@@ -69,6 +69,14 @@
{{ property.reputation }}
</div>
</div>
<div class="row">
<div class="col text-right">
Performance Cost:
</div>
<div class="col">
{{ property.performance_cost }}
</div>
</div>
{% if request.endpoint != "properties.view" %}
<br/>
<div class="row">

View File

@@ -32,6 +32,7 @@
<th>Claimed</th>
<th>Rejection Reason</th>
<th>Reputation</th>
<th>Performance Cost</th>
<th>Location</th>
</tr>
</thead>