Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 12 additions & 7 deletions src/api/legacy/legacy.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
12 changes: 9 additions & 3 deletions src/api/v1/report.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down Expand Up @@ -278,12 +278,18 @@ 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"])
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