mirror of
https://github.com/OpenFusionProject/scripts.git
synced 2024-11-25 14:50:15 +00:00
Merge a02b683272
into 9deba1956f
This commit is contained in:
commit
0203ad29cf
@ -35,19 +35,29 @@ except Exception as ex:
|
||||
|
||||
def fetch_ranks(epid, date, num):
|
||||
sql = """
|
||||
SELECT * FROM (
|
||||
SELECT RaceResults.PlayerID,
|
||||
Players.FirstName,
|
||||
Players.LastName,
|
||||
RaceResults.Score
|
||||
SELECT
|
||||
PBRaceResults.PlayerID,
|
||||
Players.FirstName,
|
||||
Players.LastName,
|
||||
PBRaceResults.Score
|
||||
FROM (
|
||||
SELECT
|
||||
ROW_NUMBER() OVER (
|
||||
PARTITION BY RaceResults.PlayerID
|
||||
ORDER BY
|
||||
RaceResults.Score DESC,
|
||||
RaceResults.RingCount DESC,
|
||||
RaceResults.Time ASC
|
||||
) AS PersonalOrder,
|
||||
RaceResults.*
|
||||
FROM RaceResults
|
||||
INNER JOIN Players ON RaceResults.PlayerID=Players.PlayerID
|
||||
WHERE EPID=? AND
|
||||
DATETIME(Timestamp,'unixepoch') > (SELECT DATETIME('now', ?))
|
||||
ORDER BY Score DESC
|
||||
)
|
||||
GROUP BY PlayerID
|
||||
ORDER BY Score DESC
|
||||
WHERE EPID=? AND DATETIME(Timestamp, 'unixepoch') > DATETIME('now', ?)
|
||||
) AS PBRaceResults
|
||||
INNER JOIN Players ON PBRaceResults.PlayerID=Players.PlayerID AND PBRaceResults.PersonalOrder=1
|
||||
ORDER BY
|
||||
PBRaceResults.Score DESC,
|
||||
PBRaceResults.RingCount DESC,
|
||||
PBRaceResults.Time ASC
|
||||
"""
|
||||
|
||||
if num > -1:
|
||||
@ -63,15 +73,16 @@ def fetch_ranks(epid, date, num):
|
||||
|
||||
def fetch_my_ranks(pcuid, epid, date):
|
||||
sql = """
|
||||
SELECT RaceResults.PlayerID,
|
||||
Players.FirstName,
|
||||
Players.LastName,
|
||||
RaceResults.Score
|
||||
SELECT
|
||||
RaceResults.PlayerID,
|
||||
Players.FirstName,
|
||||
Players.LastName,
|
||||
RaceResults.Score
|
||||
FROM RaceResults
|
||||
INNER JOIN Players ON RaceResults.PlayerID=Players.PlayerID
|
||||
WHERE RaceResults.PlayerID=? AND EPID=? AND
|
||||
DATETIME(Timestamp,'unixepoch') > (SELECT DATETIME('now', ?))
|
||||
ORDER BY Score DESC LIMIT 1;
|
||||
WHERE RaceResults.PlayerID=? AND EPID=? AND DATETIME(Timestamp, 'unixepoch') > DATETIME('now', ?)
|
||||
ORDER BY RaceResults.Score DESC
|
||||
LIMIT 1;
|
||||
"""
|
||||
|
||||
args = (pcuid, epid, date)
|
||||
|
Loading…
Reference in New Issue
Block a user