Skip to content

Commit dfdc710

Browse files
author
extreme4all
committed
lets see if this works a bit better
1 parent 056e380 commit dfdc710

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

src/api/legacy/legacy.py

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -354,13 +354,18 @@ async def sql_get_user_latest_sighting(player_id: int):
354354

355355
async def sql_get_report_data_heatmap(region_id: int):
356356
sql = """
357-
SELECT region_id, x_coord, y_coord, z_coord, confirmed_ban
358-
FROM Players pls
359-
JOIN Reports rpts ON rpts.reportedID = pls.id
360-
WHERE pls.confirmed_ban = 1
361-
AND rpts.region_id = :region_id
362-
ORDER BY pls.id DESC
363-
357+
select
358+
rl.region_id,
359+
rl.x_coord,
360+
rl.y_coord,
361+
rl.z_coord,
362+
pl.confirmed_ban
363+
from report as rp
364+
join report_location rl on rp.report_location_id = rl.report_location_id
365+
join report_sighting rs on rp.report_sighting_id = rs.report_sighting_id
366+
join Players pl on rs.reported_id = pl.id
367+
where rl.region_id = :region_id and pl.label_jagex = 2 and rp.created_at > curdate() - interval 30 DAY
368+
;
364369
"""
365370

366371
param = {"region_id": region_id}

0 commit comments

Comments
 (0)