Skip to content

Commit

Permalink
RaceRoomServer: Disabled removing last DNF driver lap for newer logs
Browse files Browse the repository at this point in the history
  • Loading branch information
mauserrifle committed Mar 5, 2024
1 parent 11d3786 commit cc5489b
Showing 1 changed file with 21 additions and 7 deletions.
28 changes: 21 additions & 7 deletions lib/Simresults/Data/Reader/RaceRoomServer.php
Original file line number Diff line number Diff line change
Expand Up @@ -186,17 +186,31 @@ protected function readSessions()
// Negative lap time, skip
if ($lap_data['Time'] < 0) continue;

// Last lap, is race session, driver is dnf and
// lap has incidents. We should exclude this lap
// since it is registered fully with sectors and total
// time as-if it were completed
$incidents = $this->helper->arrayGet($lap_data, 'Incidents');

// Last lap, is race session, driver is dnf and lap has
// incidents. We should exclude this lap since it is
// registered fully with sectors and total time as-if
// it were completed. But only when the log is not of
// a newer type.
if ($lap_key === (count($laps)-1) AND
$session->getType() === Session::TYPE_RACE AND
$participant->getFinishStatus() === Participant::FINISH_DNF AND
$this->helper->arrayGet($lap_data, 'Incidents')
$incidents
)
{
continue;
$has_other = false;
foreach ($incidents as $incident) {
if ($this->helper->arrayGet($incident, 'OtherUserId')) {
$has_other = true;
break;
}
}

// But only when the log is not of a newer type
if (!$has_other) {
continue;
}
}

// Init new lap
Expand Down Expand Up @@ -247,7 +261,7 @@ protected function readSessions()


// Has incidents
if ($incidents = $this->helper->arrayGet($lap_data, 'Incidents'))
if ($incidents)
{
// Type 0 = Car to car collision
// Type 1 = Collision with a track object
Expand Down

0 comments on commit cc5489b

Please sign in to comment.