Skip to content

Commit 18055fe

Browse files
committed
bug fixes
1 parent e5ddb0e commit 18055fe

File tree

3 files changed

+24
-4
lines changed

3 files changed

+24
-4
lines changed

server/database/database.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from sqlalchemy import BOOLEAN, Column, Integer, String, Float, Boolean, func
1+
from sqlalchemy import BOOLEAN, Column, Integer, String, Float, Boolean, func, BigInteger
22
from flask_sqlalchemy import SQLAlchemy
33
import math
44

@@ -48,7 +48,8 @@ class PowerData(database.Model):
4848
state = Column(String(20))
4949
"""Unoccupied, War, Exploited, Fortified or Stronghold"""
5050
shortcode = Column(String(4))
51-
51+
control_points = Column(Float())
52+
points_change = Column(Float())
5253

5354
class Conflicts(database.Model):
5455
__tablename__ = "conflicts"

server/database/points_change.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
from server.database.database import PowerData
2+
3+
def find_largest_change(session):
4+
entries = (
5+
session.query(
6+
PowerData
7+
).filter(
8+
PowerData.points_change != 0
9+
).filter(
10+
PowerData.points_change != None
11+
).order_by(PowerData.points_change.desc()
12+
).limit(20)
13+
)
14+
return entries
15+

server/handlers/escapePods.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,12 @@ def handle_escape_pods(request, database):
2424
}
2525

2626
shortcode = power_full_to_short(power)
27-
task_short = task_replacements[shortcode]
28-
task_full = TASKSHORTCODES[task_short]
27+
try:
28+
task_short = task_replacements[shortcode]
29+
task_full = TASKSHORTCODES[task_short]
30+
except Exception:
31+
task_short = "??"
32+
task_full = "Unknown"
2933

3034
return render_template(
3135
"tasks/escapePods.html",

0 commit comments

Comments
 (0)