Fix for !lc; invalid parameters (site, PF) nolonger trigger [ERROR]'s

Remove more debugging Stuff
Fix for penalty timers
This commit is contained in:
2021-12-16 17:41:41 +01:00
parent 53eadc12aa
commit 6aec10fb56
7 changed files with 41 additions and 16 deletions
+21 -2
View File
@@ -117,6 +117,8 @@ class LandController:
return ChatBlob(f"Orgs matching your search criteria ({num_orgs})", blob)
data = self.get_towers_by_org(org_id)
if not data:
return f"The org <highlight>{search}</highlight> does not own any sites or does not exist."
blob = ""
ql = 0
for x in data:
@@ -134,6 +136,8 @@ class LandController:
return f"Could not find playfield <highlight>{playfield_name}</highlight>."
data = self.get_towers(playfield.id, site_number)
if not data:
return f"The Site <highlight>{site_number}</highlight> does not exist in playfield <highlight>{playfield_name}</highlight>."
blob = ""
t = int(time.time())
@@ -157,15 +161,18 @@ class LandController:
def free(self, _, ):
blob = ""
data = self.get_free()
if not data:
return "Currently there are no free sites. Go kill some."
for row in data:
blob += f"<pagebreak>{self.format_site_info(row, time.time(), len(data))}\n"
return ChatBlob(f"FREE Towersites ({len(data)})", blob) if blob else f"No free towersites found."
return ChatBlob(f"FREE Towersites ({len(data)})", blob)
def format_site_info(self, row, t, count=0):
data = row
if count == 0 and data:
row = data[0]
if not row:
return "Site does not exist."
blob = f"<highlight>{row.short_name} x{row.site_number}</highlight> ({row.site_name})\n"
blob += f"<tab>Level Range: <white>{row.min_ql} - {row.max_ql}</white> "
if row.timing == 0:
@@ -273,6 +280,18 @@ class LandController:
"LEFT JOIN all_orgs e on a.org_id = e.org_id "
"WHERE a.org_id=? GROUP BY a.pf_id, a.site_number ORDER BY ql, close_time IS NOT NULL", [org_id])
# For some reason the Code above broke... and apparently works again now? leaving this one here, just in case.
# return self.db.query("""SELECT * FROM (SELECT COUNT(CASE WHEN name LIKE '%Turret%' THEN 1 WHEN name LIKE '%SAM Battery%' THEN 1 END) turrets,
# COUNT(CASE WHEN name LIKE '%Guard%' THEN 1 END) guard, a.pf_id, a.org_id, e.org_name, c.*, d.* FROM towers a
# LEFT JOIN aodb b ON a.high_id = b.highid
# LEFT JOIN playfields c on a.pf_id = c.id
# LEFT JOIN tower_sites d on a.pf_id = d.playfield_id and a.site_number = d.site_number
# LEFT JOIN all_orgs e on a.org_id = e.org_id
# WHERE a.org_id=? GROUP BY a.pf_id, a.site_number ORDER BY ql, close_time IS NOT NULL) t1
# LEFT JOIN
# (SELECT * from towers a WHERE a.org_id=? AND close_time IS NOT NULL) t2
# ON t1.pf_id=t2.pf_id AND t1.site_number = t2.site_number""", [org_id, org_id])
def find_orgs(self, search):
return self.db.query("SELECT DISTINCT a.org_name, a.org_id FROM all_orgs a "
"LEFT JOIN towers b ON a.org_id = b.org_id WHERE org_name <EXTENDED_LIKE=0> ? AND b.org_id IS NOT NULL",