changed dbprio to high from low to stop people from nominating the maps before the query finishes
This commit is contained in:
parent
45258da9e1
commit
d48a5b14c1
@ -82,7 +82,7 @@ public void SQL_OnDatabaseConnect(Database db, const char[] error, any data)
|
||||
public void OnMapStart()
|
||||
{
|
||||
int i_port = GetConVarInt(FindConVar("hostport"));
|
||||
if (i_port != 27015)
|
||||
if (i_port != 27019 && i_port != 27015)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@ -103,7 +103,7 @@ public void UpdateTopListedMapsWithCooldown()
|
||||
//just set every map in top g_iTopMapsToMarkWithCooldown on cooldown
|
||||
char sQuery[512];
|
||||
Format(sQuery, sizeof(sQuery), "update unloze_playtimestats.map_minutes_played set on_cooldown = true where mapname in ( SELECT mapname FROM (select mmp.mapname from unloze_playtimestats.map_minutes_played mmp order by mmp.minutes desc limit %i) as top) and on_cooldown is false", g_iTopMapsToMarkWithCooldown);
|
||||
g_hDatabase.Query(SQL_FinishedQuery1, sQuery, _, DBPrio_Low);
|
||||
g_hDatabase.Query(SQL_FinishedQuery1, sQuery, _, DBPrio_High);
|
||||
}
|
||||
|
||||
public void SQL_FinishedQuery1(Database db, DBResultSet results, const char[] error, DataPack data)
|
||||
@ -122,7 +122,7 @@ public void UpdateUnmarkCooldown()
|
||||
//if map in listing fell below g_iUnmarkCooldowns then set the bool to false again.
|
||||
char sQuery[512];
|
||||
Format(sQuery, sizeof(sQuery), "update unloze_playtimestats.map_minutes_played set on_cooldown = false where mapname not in ( SELECT mapname FROM (select mmp.mapname from unloze_playtimestats.map_minutes_played mmp order by mmp.minutes desc limit %i) as top) and on_cooldown is true", g_iUnmarkCooldowns);
|
||||
g_hDatabase.Query(SQL_FinishedQuery2, sQuery, _, DBPrio_Low);
|
||||
g_hDatabase.Query(SQL_FinishedQuery2, sQuery, _, DBPrio_High);
|
||||
}
|
||||
|
||||
public void SQL_FinishedQuery2(Database db, DBResultSet results, const char[] error, DataPack data)
|
||||
@ -140,7 +140,7 @@ public void SelectMapsToCooldownForMapChooser()
|
||||
{
|
||||
char sQuery[512];
|
||||
Format(sQuery, sizeof(sQuery), "select mapname, map_list_index from (select mapname, ROW_NUMBER() OVER(ORDER BY minutes DESC) as map_list_index, mmp.on_cooldown from unloze_playtimestats.map_minutes_played mmp) as targets where on_cooldown");
|
||||
g_hDatabase.Query(SQL_FinishedQuerySelectMaps, sQuery, _, DBPrio_Low);
|
||||
g_hDatabase.Query(SQL_FinishedQuerySelectMaps, sQuery, _, DBPrio_High);
|
||||
}
|
||||
|
||||
public void SQL_FinishedQuerySelectMaps(Database db, DBResultSet results, const char[] error, DataPack data)
|
||||
@ -165,19 +165,19 @@ public void SQL_FinishedQuerySelectMaps(Database db, DBResultSet results, const
|
||||
public void OnMapEnd()
|
||||
{
|
||||
int i_port = GetConVarInt(FindConVar("hostport"));
|
||||
if (i_port != 27015)
|
||||
if (i_port != 27019 && i_port != 27015)
|
||||
{
|
||||
return;
|
||||
}
|
||||
int elapsed = GetTime() - g_iMapStartTime;
|
||||
int minutes = RoundToFloor(elapsed / 60.0);
|
||||
|
||||
char Mapname[128];
|
||||
GetCurrentMap(Mapname, sizeof(Mapname));
|
||||
//LogMessage("minutes: %i. map: %s", minutes, Mapname);
|
||||
|
||||
if (g_iCurrentPlayerCount > g_iPlayerCount_time_track)
|
||||
{
|
||||
int elapsed = GetTime() - g_iMapStartTime;
|
||||
int minutes = RoundToFloor(elapsed / 60.0);
|
||||
LogMessage("minutes: %i", minutes);
|
||||
|
||||
char Mapname[128];
|
||||
GetCurrentMap(Mapname, sizeof(Mapname));
|
||||
|
||||
char sQuery[512];
|
||||
Format(sQuery, sizeof(sQuery), "INSERT INTO `map_minutes_played` (`mapname`, `minutes`, `updated_on`) VALUES ('%s', '%i', NOW()) ON DUPLICATE KEY UPDATE `minutes` = `minutes` + '%i', `updated_on` = NOW()", Mapname, minutes, minutes);
|
||||
g_hDatabase.Query(SQL_FinishedQuery, sQuery, _, DBPrio_Low);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user