Skip to content

Commit

Permalink
Allow to disable sortOpponents in participants table (#3382)
Browse files Browse the repository at this point in the history
  • Loading branch information
hjpalpha authored Oct 14, 2023
1 parent 591f8c0 commit 59df874
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ end
---@field colSpan number
---@field resolveDate string
---@field sortPlayers boolean sort players within an opponent
---@field sortOpponents boolean
---@field showTeams boolean
---@field title string?
---@field importOnlyQualified boolean?
Expand All @@ -91,6 +92,7 @@ function ParticipantTable.readConfig(args, parentConfig)
onlyNotable = Logic.readBool(args.onlyNotable or parentConfig.onlyNotable),
resolveDate = args.date or parentConfig.resolveDate or DateExt.getContextualDate(),
sortPlayers = Logic.readBool(args.sortPlayers or parentConfig.sortPlayers),
sortOpponents = Logic.nilOr(Logic.readBoolOrNil(args.sortOpponents), parentConfig.sortOpponents, true),
showTeams = not Logic.readBool(args.disable_teams),
title = args.title,
importOnlyQualified = Logic.readBool(args.onlyQualified),
Expand Down Expand Up @@ -174,7 +176,9 @@ function ParticipantTable:readSection(args)
return entry
end)

Array.sortInPlaceBy(section.entries, function(entry) return entry.name:lower() end)
if config.sortOpponents then
Array.sortInPlaceBy(section.entries, function(entry) return entry.name:lower() end)
end

table.insert(self.sections, section)
end
Expand Down

0 comments on commit 59df874

Please sign in to comment.