コード例 #1
0
ファイル: Inserter.php プロジェクト: 9x/Runalyze
 /**
  * Calculate stride length
  */
 protected function calculateStrideLength()
 {
     if ($this->Object->sportid() == Configuration::General()->runningSport()) {
         if (null !== $this->Trackdata && $this->Trackdata->has(Model\Trackdata\Object::CADENCE)) {
             $Calculator = new \Runalyze\Calculation\StrideLength\Calculator($this->Trackdata);
             $Calculator->calculate();
             $this->Object->set(Object::STRIDE_LENGTH, $Calculator->average());
         } elseif ($this->Object->cadence() > 0) {
             $this->Object->set(Object::STRIDE_LENGTH, \Runalyze\Calculation\StrideLength\Calculator::forActivity($this->Object));
         }
     }
 }
コード例 #2
0
ファイル: Inserter.php プロジェクト: schoch/Runalyze
 /**
  * Calculate stride length
  */
 protected function calculateStrideLength()
 {
     if ($this->Object->sportid() == Configuration::General()->runningSport() && NULL !== $this->Trackdata) {
         $Calculator = new \Runalyze\Calculation\StrideLength\Calculator($this->Trackdata);
         $Calculator->calculate();
         $this->Object->set(Object::STRIDE_LENGTH, $Calculator->average());
     }
 }
コード例 #3
0
ファイル: Updater.php プロジェクト: schoch/Runalyze
 /**
  * Update stride length
  */
 protected function updateStrideLength()
 {
     if ($this->hasChanged(Object::SPORTID)) {
         if ($this->NewObject->sportid() == Configuration::General()->runningSport()) {
             $Calculator = new \Runalyze\Calculation\StrideLength\Calculator($this->Trackdata);
             $Calculator->calculate();
             $this->NewObject->set(Object::STRIDE_LENGTH, $Calculator->average());
         } else {
             $this->NewObject->set(Object::STRIDE_LENGTH, 0);
         }
     }
 }