/** * 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)); } } }
/** * 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()); } }
/** * 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); } } }