Skip to content

Commit

Permalink
Merge pull request #1069 from JustaPenguin/race-weekend-split-sorting…
Browse files Browse the repository at this point in the history
…-pitbox

sort race weekend entrants by pitbox after they have been added to an entrylist in the filter step
  • Loading branch information
cj123 authored Jan 28, 2021
2 parents 0c2c86d + 8f8fa5f commit d771c51
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Fixed:

* Fixes an issue where duplicating a Championship with Race Weekends inside it would result in the Race Weekends not copying across correctly.
* KissMyRank is now instructed to stop using a command in its console. This should hopefully prevent issues with data files corrupting on stop.
* Fixes an issue where Race Weekend sessions could incorrectly sort splits out of order.

---

Expand Down
5 changes: 5 additions & 0 deletions race_weekend.go
Original file line number Diff line number Diff line change
Expand Up @@ -869,6 +869,11 @@ func (rws *RaceWeekendSession) GetRaceWeekendEntryList(rw *RaceWeekend, override
}
}

// do an initial sort of the entrylist by pitboxes, as sessions may add drivers out of order.
sort.Slice(entryList, func(i, j int) bool {
return entryList[i].PitBox < entryList[j].PitBox
})

if rw.SessionCanBeRun(rws) {
// sorting can only be run if a session is ready to be run.
sorter := GetRaceWeekendEntryListSort(rws.SortType)
Expand Down

0 comments on commit d771c51

Please sign in to comment.