/** * 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()); }
/** * 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(Object::SPORTID); if ($this->ForceRecalculations || $wasNotRunning || $this->hasChanged(Object::TIME_IN_SECONDS) || $this->hasChanged(Object::DISTANCE) || $this->hasChanged(Object::HR_AVG) || $this->hasChanged(Object::ELEVATION)) { $this->NewObject->set(Object::VDOT_BY_TIME, $Calculator->calculateVDOTbyTime()); $this->NewObject->set(Object::JD_INTENSITY, $Calculator->calculateJDintensity()); $this->NewObject->set(Object::VDOT, $Calculator->calculateVDOTbyHeartRate()); $this->NewObject->set(Object::VDOT_WITH_ELEVATION, $Calculator->calculateVDOTbyHeartRateWithElevation()); } } else { $this->NewObject->unsetRunningValues(); } if ($this->ForceRecalculations || $this->hasChanged(Object::TIME_IN_SECONDS) || $this->hasChanged(Object::HR_AVG)) { $this->NewObject->set(Object::TRIMP, $Calculator->calculateTrimp()); } }