/** * Update basic endurance */ protected function updateBasicEndurance() { $timestampLimit = time() - 182 * DAY_IN_S; if (($this->hasChanged(Entity::DISTANCE) || $this->hasChanged(Entity::TIMESTAMP) || $this->hasChanged(Entity::SPORTID)) && ($this->NewObject->sportid() == Configuration::General()->runningSport() && $this->NewObject->timestamp() > $timestampLimit || $this->knowsOldObject() && $this->OldObject->sportid() == Configuration::General()->runningSport() && $this->OldObject->timestamp() > $timestampLimit)) { BasicEndurance::recalculateValue(); } }
/** * Trigger recalculation */ public static function triggerRecalculation() { if (!self::$TRIGGERED) { self::$TRIGGERED = true; $oldValue = CalculationBasicEndurance::getConst(); CalculationBasicEndurance::recalculateValue(); $newValue = CalculationBasicEndurance::getConst(); Messages::addValueRecalculated(__('Basic endurance'), $newValue . ' %', $oldValue . ' %'); } }
/** * Update basic endurance */ protected function updateBasicEndurance() { $timestampLimit = time() - 182 * DAY_IN_S; if ($this->Object->sportid() == Configuration::General()->runningSport() && $this->Object->timestamp() > $timestampLimit) { BasicEndurance::recalculateValue(); } }
/** * Recalculate basic endurance */ protected function recalculateBasicEndurance() { $oldValue = Configuration::Data()->basicEndurance(); BasicEndurance::recalculateValue(); $newValue = Configuration::Data()->basicEndurance(); $this->addSuccessMessage(__('Basic endurance'), $oldValue, $newValue); }