Skip to content

Conversation

@umr-1000
Copy link

@umr-1000 umr-1000 commented Jan 8, 2026

Add checks for nil values in team streak and rating.

Summary

There is currently an error on the Liquipedia Rating portal page (https://liquipedia.net/rocketleague/Portal:Rating) that prevents the rating list being created:

Module:Ratings/Display/List:70: attempt to compare number with nil (stack trace logged)

The following change allows the rating list to work as usual on the portal page by discarding teams which return nil values in their streak or rating.

How did you test this change?

Tested the changes using |dev=umr on my userspace (https://liquipedia.net/rocketleague/User:Umr_1000/draft). The rating list is generated with the given change without any issues.

Add checks for nil values in team streak and rating.
Copilot AI review requested due to automatic review settings January 8, 2026 08:00
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds nil checks for team streak and rating properties to prevent a runtime error on the Liquipedia Rating portal page. The error was occurring when attempting to compare nil values with numbers.

  • Adds nil validation before processing team data in the ratings list display
  • Skips teams with missing streak or rating values to allow the page to render

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +36 to +38
if (team.streak == nil) or (team.rating == nil) then
return
end
Copy link

Copilot AI Jan 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Skipping teams with nil streak or rating values will cause the rank numbers to be incorrect. The rank is passed from Array.forEach which counts all teams including skipped ones. Consider filtering teams before the forEach loop to maintain accurate rankings, or adjust the rank counter when teams are skipped.

Copilot uses AI. Check for mistakes.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nếu

:allDone()

Array.forEach(teams, function(team, rank)
if (team.streak == nil) or (team.rating == nil) then
Copy link

Copilot AI Jan 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The parentheses around the nil checks are unnecessary in Lua. The condition can be simplified to: if team.streak == nil or team.rating == nil then

Copilot uses AI. Check for mistakes.
Copy link
Collaborator

@hjpalpha hjpalpha left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

better would be to filter before the forEach loop

	local validTeams = Array.filter(teams, function(team)
		return team.streak ~= nil and team.rating ~= nil
	end)

	Array.forEach(validTeams, function(team, rank)
.....

@ElectricalBoy ElectricalBoy added the g: rocket league Rocket League label Jan 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

g: rocket league Rocket League

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants