コード例 #1
0
 /**
  * Set values like distance, duration, etc. from gps data if they are empty
  */
 private function setValuesFromArraysIfEmpty()
 {
     if (!$this->TrainingObject->hasDistance()) {
         if ($this->TrainingObject->hasArrayDistance()) {
             $this->TrainingObject->setDistance($this->TrainingObject->getArrayDistanceLastPoint());
         } elseif (!$this->TrainingObject->Splits()->areEmpty()) {
             $this->TrainingObject->setDistance($this->TrainingObject->Splits()->totalDistance());
         }
     }
     if ($this->TrainingObject->getTimeInSeconds() == 0) {
         if ($this->TrainingObject->hasArrayTime()) {
             $this->TrainingObject->setTimeInSeconds($this->TrainingObject->getArrayTimeLastPoint());
         } elseif (!$this->TrainingObject->Splits()->areEmpty()) {
             $this->TrainingObject->setTimeInSeconds($this->TrainingObject->Splits()->totalTime());
         }
     }
     if ($this->TrainingObject->getPulseAvg() == 0 && $this->TrainingObject->getPulseMax() == 0) {
         $this->setAvgAndMaxHeartrateFromArray();
     }
     $this->setAvgCadenceFromArray();
     $this->setAvgPowerFromArray();
     $this->setTemperatureFromArray();
     $this->setRunningDynamicsFromArray();
     $this->setDistanceFromGPSdata();
 }