diff --git a/src/api/legacy/legacy.py b/src/api/legacy/legacy.py index b402a93..a206d54 100644 --- a/src/api/legacy/legacy.py +++ b/src/api/legacy/legacy.py @@ -354,13 +354,18 @@ async def sql_get_user_latest_sighting(player_id: int): async def sql_get_report_data_heatmap(region_id: int): sql = """ - SELECT region_id, x_coord, y_coord, z_coord, confirmed_ban - FROM Players pls - JOIN Reports rpts ON rpts.reportedID = pls.id - WHERE pls.confirmed_ban = 1 - AND rpts.region_id = :region_id - ORDER BY pls.id DESC - + select + rl.region_id, + rl.x_coord, + rl.y_coord, + rl.z_coord, + pl.confirmed_ban + from report as rp + join report_location rl on rp.report_location_id = rl.report_location_id + join report_sighting rs on rp.report_sighting_id = rs.report_sighting_id + join Players pl on rs.reported_id = pl.id + where rl.region_id = :region_id and pl.label_jagex = 2 and rp.created_at > curdate() - interval 30 DAY + ; """ param = {"region_id": region_id} diff --git a/src/api/v1/report.py b/src/api/v1/report.py index 29b9025..8935f9f 100644 --- a/src/api/v1/report.py +++ b/src/api/v1/report.py @@ -217,7 +217,7 @@ async def select_or_insert_migration(name: str): """ sql_insert = """ INSERT report_migrated (reporting_id, migrated) - SELECT id, 0 as migrated FROM Players pl where pl.name = :name + SELECT id, 1 as migrated FROM Players pl where pl.name = :name """ params = {"name": name} @@ -278,7 +278,10 @@ async def get_report_count_v1(name: str): """ Get the calculated player report count """ - return await report_count(name=name, manual_detect=0) + # _count = report_count(name=name, manual_detect=0) + # _count = await select_report_count_v1(name=name, manual_detect=0) + _count = await select_report_count_v2(name=name, manual_detect=0) + return _count @router.get("/report/manual/count", tags=["Report"]) @@ -286,4 +289,7 @@ async def get_report_manual_count_v1(name: str): """ Get the calculated player report count """ - return await report_count(name=name, manual_detect=1) + # _count = report_count(name=name, manual_detect=1) + # _count = await select_report_count_v1(name=name, manual_detect=1) + _count = await select_report_count_v2(name=name, manual_detect=1) + return _count