Skip to content

Commit e3f9a4a

Browse files
committed
fix: solve patch sort and side win mismatch
1 parent aeec607 commit e3f9a4a

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

app/modules/analytics/controllers/competitive_controller.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,8 @@ def build_tournament_stats(matches)
271271

272272
wins = t_matches.victories.count
273273
losses = games - wins
274-
patches = t_matches.where.not(patch_version: nil).distinct.pluck(:patch_version).compact.sort
274+
patches = t_matches.where.not(patch_version: [nil, '']).distinct.pluck(:patch_version).compact
275+
.sort_by { |v| v.split('.').map(&:to_i) }
275276
t_dates = t_matches.where.not(match_date: nil)
276277

277278
date_range = if t_dates.exists?
@@ -338,7 +339,7 @@ def build_opponents_data(rows)
338339
def build_patch_meta(rows)
339340
rows.group_by { |m| m.patch_version.presence }
340341
.filter_map { |patch, patch_rows| build_patch_entry(patch, patch_rows) }
341-
.sort_by { |entry| entry[:patch] }
342+
.sort_by { |entry| entry[:patch].split('.').map(&:to_i) }
342343
.reverse
343344
end
344345

0 commit comments

Comments
 (0)