/** * Update VDOT, jd intensity, TRIMP */ protected function updateVDOTAndIntensityAndTrimp() { $Calculator = new \Runalyze\Calculation\Activity\Calculator($this->NewObject, $this->Trackdata, $this->Route); if ($this->NewObject->sportid() == Configuration::General()->runningSport()) { $wasNotRunning = $this->knowsOldObject() && $this->hasChanged(Entity::SPORTID); if ($this->ForceRecalculations || $wasNotRunning || $this->hasChanged(Entity::TIME_IN_SECONDS) || $this->hasChanged(Entity::DISTANCE) || $this->hasChanged(Entity::HR_AVG) || $this->hasChanged(Entity::ELEVATION)) { $this->NewObject->set(Entity::VDOT_BY_TIME, $Calculator->calculateVDOTbyTime()); $this->NewObject->set(Entity::JD_INTENSITY, $Calculator->calculateJDintensity()); $this->NewObject->set(Entity::VDOT, $Calculator->calculateVDOTbyHeartRate()); $this->NewObject->set(Entity::VDOT_WITH_ELEVATION, $Calculator->calculateVDOTbyHeartRateWithElevation()); } } else { $this->NewObject->unsetRunningValues(); } if ($this->ForceRecalculations || (null === $this->Trackdata || !$this->Trackdata->has(Model\Trackdata\Entity::TIME) || !$this->Trackdata->has(Model\Trackdata\Entity::HEARTRATE)) && ($this->hasChanged(Entity::SPORTID) || $this->hasChanged(Entity::TIME_IN_SECONDS) || $this->hasChanged(Entity::HR_AVG))) { $this->NewObject->set(Entity::TRIMP, $Calculator->calculateTrimp()); } }
/** * Calculate VDOT, jd intensity, TRIMP */ protected function calculateVDOTAndIntensityAndTrimp() { $Calculator = new \Runalyze\Calculation\Activity\Calculator($this->Object, $this->Trackdata, $this->Route); if ($this->Object->sportid() == Configuration::General()->runningSport()) { $this->Object->set(Object::VDOT_BY_TIME, $Calculator->calculateVDOTbyTime()); $this->Object->set(Object::VDOT, $Calculator->calculateVDOTbyHeartRate()); $this->Object->set(Object::VDOT_WITH_ELEVATION, $Calculator->calculateVDOTbyHeartRateWithElevation()); $this->Object->set(Object::JD_INTENSITY, $Calculator->calculateJDintensity()); if (class_exists('RunalyzePluginPanel_Rechenspiele') && $this->Object->timestamp() > time() - 14 * DAY_IN_S) { \Cache::delete(\RunalyzePluginPanel_Rechenspiele::CACHE_KEY_JD_POINTS); } } else { $this->Object->unsetRunningValues(); } $this->Object->set(Object::TRIMP, $Calculator->calculateTrimp()); }