Changeset 42 for trunk/index.php


Ignore:
Timestamp:
Sep 14, 2020, 1:41:50 PM (4 years ago)
Author:
chronos
Message:
  • Fixed: Division by zero in speed calculation.
  • Fixed: Wrong year loaded for runner without team.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/index.php

    r41 r42  
    572572        else $Output .= '<td>&nbsp;</td>';
    573573      $Output .= '<td>'.$Item['Length'].'</td>';
    574       $Speed = $Item['Length'] / $Item['Duration'] * 3600;
     574
    575575      if (($Item['Duration'] > 0) and ($Item['Duration'] < $Item['Length'] * 3600 / $this->MinRunnerSpeed))
     576      {
     577        $Speed = $Item['Length'] / $Item['Duration'] * 3600;
    576578        $Output .= '<td>'.$PrefixMultiplier->Add($Speed, '', 4, 'Decimal').'</td>';
    577         else $Output .= '<td>&nbsp;</td>';
     579      } else $Output .= '<td>&nbsp;</td>';
    578580      $Output .= '</tr>';
    579581    }
     
    726728    if (!is_numeric($RunnerId)) die(T('Runner id needs to be numeric'));
    727729
    728     $DbResult = $this->Database->query('SELECT Runner.Name, Team.Name AS TeamName, Team.Id AS TeamId, Team.Year FROM Runner LEFT JOIN Team ON Team.Id=Runner.Team WHERE Runner.Id='.$RunnerId);
     730    $DbResult = $this->Database->query('SELECT Runner.Name, Team.Name AS TeamName, Team.Id AS TeamId, Runner.Year FROM Runner LEFT JOIN Team ON Team.Id=Runner.Team WHERE Runner.Id='.$RunnerId);
    729731    $DbRow = $DbResult->fetch_assoc();
    730732    $this->Title = T('Runner').' '.$DbRow['Name'].' - '.$this->Title;
Note: See TracChangeset for help on using the changeset viewer.