Skip to content

Commit deb6b7e

Browse files
committed
fix: solve pro matches card issues
1 parent b822156 commit deb6b7e

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

app/modules/competitive/controllers/pro_matches_controller.rb

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -456,7 +456,7 @@ def match_preview
456456
def es_series
457457
team1 = params[:team1].to_s.strip
458458
team2 = params[:team2].to_s.strip
459-
limit = (params[:limit] || 20).to_i.clamp(1, 50)
459+
limit = (params[:limit] || 5).to_i.clamp(1, 50)
460460

461461
raise ArgumentError, 'team1 and team2 are required' if team1.blank? || team2.blank?
462462

@@ -524,9 +524,7 @@ def team_clause(name, field)
524524
def win_team_clause(name)
525525
clauses = [{ term: { win_team: name } }]
526526

527-
if name.split.length > 1
528-
clauses << { wildcard: { win_team: { value: "#{name}*", case_insensitive: true } } }
529-
end
527+
clauses << { wildcard: { win_team: { value: "#{name}*", case_insensitive: true } } } if name.split.length > 1
530528

531529
{ bool: { should: clauses, minimum_should_match: 1 } }
532530
end
@@ -576,7 +574,8 @@ def serialize_team(team_data, recent_matches)
576574
image_url: p['image_url'],
577575
nationality: p['nationality']
578576
}
579-
end.sort_by { |p| %w[top jun mid adc sup].index(p[:role]) || 99 },
577+
end.select { |p| %w[top jun mid adc sup].include?(p[:role]) }
578+
.sort_by { |p| %w[top jun mid adc sup].index(p[:role]) },
580579
recent: (recent_matches || []).first(5).map { |m| serialize_recent_match(m, team_data['id']) }
581580
}
582581
end

0 commit comments

Comments
 (0)