Skip to content

Commit b91b563

Browse files
committed
implemented playerrank in ST code
1 parent a9a1e2d commit b91b563

File tree

1 file changed

+7
-18
lines changed

1 file changed

+7
-18
lines changed

surftimer/ck_playerrank.py

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1036,9 +1036,7 @@ async def countryTop(
10361036

10371037
xquery = selectQuery(surftimer.queries.sql_stray_countryTop.format(country, style))
10381038

1039-
if xquery:
1040-
xquery = xquery.pop()
1041-
else:
1039+
if len(xquery) <= 0:
10421040
response.status_code = status.HTTP_204_NO_CONTENT
10431041
return response
10441042

@@ -1078,9 +1076,7 @@ async def countryTopAllCountries(
10781076
surftimer.queries.sql_stray_countryTopAllCountries.format(style)
10791077
)
10801078

1081-
if xquery:
1082-
xquery = xquery.pop()
1083-
else:
1079+
if len(xquery) <= 0:
10841080
response.status_code = status.HTTP_204_NO_CONTENT
10851081
return response
10861082

@@ -1300,9 +1296,7 @@ async def continentTop(
13001296
surftimer.queries.sql_stray_continentTop.format(continentCode, style)
13011297
)
13021298

1303-
if xquery:
1304-
xquery = xquery.pop()
1305-
else:
1299+
if len(xquery) <= 0:
13061300
response.status_code = status.HTTP_204_NO_CONTENT
13071301
return response
13081302

@@ -1340,9 +1334,7 @@ async def continentNames(
13401334

13411335
xquery = selectQuery(surftimer.queries.sql_stray_continentNames.format(style))
13421336

1343-
if xquery:
1344-
xquery = xquery.pop()
1345-
else:
1337+
if len(xquery) <= 0:
13461338
response.status_code = status.HTTP_204_NO_CONTENT
13471339
return response
13481340

@@ -1383,9 +1375,7 @@ async def viewPlayerRank(
13831375
surftimer.queries.sql_stray_viewPlayerRank.format(style, steamid32, style)
13841376
)
13851377

1386-
if xquery:
1387-
xquery = xquery.pop()
1388-
else:
1378+
if len(xquery) <= 0:
13891379
response.status_code = status.HTTP_204_NO_CONTENT
13901380
return response
13911381

@@ -1532,12 +1522,11 @@ async def rankCommandSelf(
15321522
request: Request,
15331523
response: Response,
15341524
steamid32: str,
1535-
limit: int,
15361525
):
15371526
"""`char[] sql_stray_rankCommandSelf = ....`"""
15381527
tic = time.perf_counter()
15391528

1540-
cache_key = f"rankCommandSelf:{steamid32}-{limit}"
1529+
cache_key = f"rankCommandSelf:{steamid32}"
15411530
cached_data = get_cache(cache_key)
15421531
if cached_data is not None:
15431532
print(f"[Redis] Loaded '{cache_key}' ({time.perf_counter() - tic:0.4f}s)")
@@ -1547,7 +1536,7 @@ async def rankCommandSelf(
15471536
return response
15481537

15491538
xquery = selectQuery(
1550-
surftimer.queries.sql_stray_rankCommandSelf.format(steamid32, limit)
1539+
surftimer.queries.sql_stray_rankCommandSelf.format(steamid32)
15511540
)
15521541

15531542
if xquery:

0 commit comments

Comments
 (0)