Skip to content

Commit b6df778

Browse files
committed
bonus done
1 parent 7caa246 commit b6df778

File tree

2 files changed

+14
-8
lines changed

2 files changed

+14
-8
lines changed

surftimer/ck_bonus.py

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -800,9 +800,7 @@ def selectPersonalBonusStylesRecords(
800800
)
801801
)
802802

803-
if xquery:
804-
xquery = xquery.pop()
805-
else:
803+
if len(xquery) <= 0:
806804
response.status_code = status.HTTP_204_NO_CONTENT
807805
return response
808806

@@ -887,11 +885,18 @@ def getRankSteamIdBonus(
887885
response.body = json.loads(cached_data, use_decimal=True, parse_nan=True)
888886
return response
889887

890-
xquery = selectQuery(
891-
surftimer.queries.sql_stray_getRankSteamIdBonus.format(
892-
mapname, zonegroup, limit
888+
if zonegroup == 0:
889+
xquery = selectQuery(
890+
surftimer.queries.sql_stray_steamIdFromMapRank.format(
891+
mapname, limit
892+
)
893+
)
894+
else:
895+
xquery = selectQuery(
896+
surftimer.queries.sql_stray_getRankSteamIdBonus.format(
897+
mapname, zonegroup, limit
898+
)
893899
)
894-
)
895900

896901
if xquery:
897902
xquery = xquery.pop()

surftimer/queries.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,9 @@
113113
sql_selectAllMapTimesinMap = (
114114
"SELECT runtimepro from ck_playertimes WHERE mapname = '{}';"
115115
)
116-
116+
sql_stray_steamIdFromMapRank = "SELECT steamid FROM ck_playertimes WHERE mapname = '{}' AND style = 0 AND runtimepro > -1.0 ORDER BY runtimepro ASC LIMIT {}, 1;"
117117
sql_selectMapRankUnknownWithMap = "SELECT `steamid`, `name`, `mapname`, `runtimepro` FROM `ck_playertimes` WHERE `mapname` = '{}' AND style = 0 ORDER BY `runtimepro` ASC LIMIT {}, 1;"
118+
118119
## ck_spawnlocations
119120
sql_createSpawnLocations = "CREATE TABLE IF NOT EXISTS ck_spawnlocations (mapname VARCHAR(54) NOT NULL, pos_x FLOAT NOT NULL, pos_y FLOAT NOT NULL, pos_z FLOAT NOT NULL, ang_x FLOAT NOT NULL, ang_y FLOAT NOT NULL, ang_z FLOAT NOT NULL, `vel_x` float NOT NULL DEFAULT '0', `vel_y` float NOT NULL DEFAULT '0', `vel_z` float NOT NULL DEFAULT '0', zonegroup INT(12) DEFAULT 0, stage INT(12) DEFAULT 0, teleside INT(11) DEFAULT 0, PRIMARY KEY(mapname, zonegroup, stage, teleside)) DEFAULT CHARSET=utf8mb4;"
120121
sql_insertSpawnLocations = "INSERT INTO ck_spawnlocations (mapname, pos_x, pos_y, pos_z, ang_x, ang_y, ang_z, vel_x, vel_y, vel_z, zonegroup, teleside) VALUES ('{}', '{}', '{}', '{}', '{}', '{}', '{}', '{}', '{}', '{}', {}, {});"

0 commit comments

Comments
 (0)