Skip to content

Commit 6837717

Browse files
authored
Merge pull request #541 from Bot-detector/develop
release
2 parents af0376e + dfdc710 commit 6837717

2 files changed

Lines changed: 21 additions & 10 deletions

File tree

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}

src/api/v1/report.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ async def select_or_insert_migration(name: str):
217217
"""
218218
sql_insert = """
219219
INSERT report_migrated (reporting_id, migrated)
220-
SELECT id, 0 as migrated FROM Players pl where pl.name = :name
220+
SELECT id, 1 as migrated FROM Players pl where pl.name = :name
221221
"""
222222

223223
params = {"name": name}
@@ -278,12 +278,18 @@ async def get_report_count_v1(name: str):
278278
"""
279279
Get the calculated player report count
280280
"""
281-
return await report_count(name=name, manual_detect=0)
281+
# _count = report_count(name=name, manual_detect=0)
282+
# _count = await select_report_count_v1(name=name, manual_detect=0)
283+
_count = await select_report_count_v2(name=name, manual_detect=0)
284+
return _count
282285

283286

284287
@router.get("/report/manual/count", tags=["Report"])
285288
async def get_report_manual_count_v1(name: str):
286289
"""
287290
Get the calculated player report count
288291
"""
289-
return await report_count(name=name, manual_detect=1)
292+
# _count = report_count(name=name, manual_detect=1)
293+
# _count = await select_report_count_v1(name=name, manual_detect=1)
294+
_count = await select_report_count_v2(name=name, manual_detect=1)
295+
return _count

0 commit comments

Comments
 (0)