Exemple #1
0
 public function testWithOnlyHRmax()
 {
     $HR = new HeartRate(150, new Athlete(null, 200));
     $this->assertTrue($HR->canShowInHRmax());
     $this->assertFalse($HR->canShowInHRrest());
     $this->assertEquals(75, $HR->inHRmax());
 }
 /**
  * Init data
  */
 protected function initData()
 {
     $this->paceUnit = $this->Context->sport()->paceUnit();
     $Zones = $this->computeZones();
     $hrMax = Runalyze\Configuration::Data()->HRmax();
     $Pace = new Pace(0, 1, $this->paceUnit);
     $HR = new HeartRate(0, Runalyze\Context::Athlete());
     foreach ($Zones as $paceInSeconds => $Info) {
         if ($Info['time'] > parent::MINIMUM_TIME_IN_ZONE) {
             $Pace->setTime($paceInSeconds);
             $HR->setBPM($Info['time'] > 0 ? $Info['hr'] / $Info['time'] : 0);
             $this->Data[] = array('zone' => $paceInSeconds == 0 ? __('faster') : '> ' . $Pace->valueWithAppendix(), 'time' => $Info['time'], 'distance' => $Info['distance'], 'average' => $HR->asBPM() > 0 ? $HR->string() : '-');
         }
     }
 }