merged branch 'speed-records', squashed

This commit is contained in:
2024-10-18 21:21:02 -07:00
parent ded4e29594
commit 4d1816e0ce
11 changed files with 275 additions and 79 deletions

View File

@@ -0,0 +1,5 @@
select speed, ifnull(alias, 'Unregistered Player')
from Speed, Fastest_players
left join Id2alias
on idvalue = cryptokey
where Speed.mapid = Fastest_players. mapid and Speed.mapid = ?

View File

@@ -0,0 +1,12 @@
select Speed.mapid, max(trank), speed, ifnull(alias, 'Unregistered Player')
from Speed, Fastest_players, Cts_times
left join Id2alias
on Fastest_players.idvalue = cryptokey
where Speed.mapid = Fastest_players.mapid
and Cts_times.mapid = Speed.mapid
and tvalue != 0
group by Cts_times.mapid
order by count(trank) DESC;
-- if condition tvalue != 0 is not present
-- database will return that maps have 99 records

View File

@@ -22,6 +22,18 @@ CREATE TABLE Id2alias(
alias TEXT,
PRIMARY KEY (cryptokey)
);
drop table if exists Speed;
create table Speed(
mapid text,
speed float,
primary key (mapid)
);
drop table if exists Fastest_players;
create table Fastest_players (
mapid text,
idvalue text,
primary key (mapid)
);
-- These table fields are unaltered.
-- Exerpts from source/qcsrc/race.qc
@@ -38,4 +50,4 @@ CREATE TABLE Id2alias(
-- re: foreign key from & to Cts_ranks & Id2alias.
-- An ranked unregistered player will have a row in Cts_ranks, but will not have a row in Id2alias.
-- A registered player may have a row in Id2alias, but may not necessary have a rank.
-- A registered player may have a row in Id2alias, but may not necessary have a rank.