fix /diff when squad starts to exists in leaderboard

This commit is contained in:
norohind 2021-11-30 16:20:51 +03:00
parent b0003fb153
commit 36bb3a78eb
Signed by: norohind
GPG Key ID: 01C3BECC26FB59E1
2 changed files with 6 additions and 6 deletions

View File

@ -57,16 +57,16 @@ limit %(limit)s;"""
select_diff_by_action_id = """select select_diff_by_action_id = """select
new_stats.name as "SquadronName", new_stats.name as "SquadronName",
new_stats.tag, new_stats.tag,
new_stats.score as "TotalExperience", coalesce(new_stats.score, 0) as "TotalExperience",
old_stats.score as "TotalExperienceOld", coalesce(old_stats.score, 0) as "TotalExperienceOld",
new_stats.score - old_stats.score as "TotalExperienceDiff", coalesce(new_stats.score, 0) - coalesce(old_stats.score, 0) as "TotalExperienceDiff",
new_stats.leaderboard_type as "LeaderBoardType", new_stats.leaderboard_type as "LeaderBoardType",
new_stats.platform as "Platform" new_stats.platform as "Platform"
from ( from (
select * select *
from squads_stats_states from squads_stats_states
where action_id = %(action_id)s) new_stats where action_id = %(action_id)s) new_stats
inner join full join
( (
select * select *
from squads_stats_states from squads_stats_states
@ -83,5 +83,5 @@ inner join
order by squads_stats_states.action_id desc order by squads_stats_states.action_id desc
limit 1)) old_stats limit 1)) old_stats
on new_stats.squadron_id = old_stats.squadron_id on new_stats.squadron_id = old_stats.squadron_id
where new_stats.score - old_stats.score > 0 where coalesce(new_stats.score, 0) - coalesce(old_stats.score, 0) <> 0
order by new_stats.score - old_stats.score desc;""" order by new_stats.score - old_stats.score desc;"""

View File

@ -13,7 +13,7 @@ function buildHtmlTable(arr) {
for (var j = 0, maxj = columns.length; j < maxj; ++j) { for (var j = 0, maxj = columns.length; j < maxj; ++j) {
var td = _td_.cloneNode(false); var td = _td_.cloneNode(false);
cellValue = arr[i][columns[j]]; cellValue = arr[i][columns[j]];
td.appendChild(document.createTextNode(arr[i][columns[j]] || '')); td.appendChild(document.createTextNode(arr[i][columns[j]]));
tr.appendChild(td); tr.appendChild(td);
} }
table.appendChild(tr); table.appendChild(tr);