Example #1
0
 /**
  * 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();
     }
 }
Example #2
0
 /**
  * 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();
     }
 }
Example #3
0
 /**
  * Weekday
  * @return string
  */
 public function weekday()
 {
     if (!is_numeric($this->Activity->timestamp())) {
         return '';
     }
     return Time::weekday(date('w', $this->Activity->timestamp()));
 }
Example #4
0
 /**
  * Navigation for editor
  * @return string
  */
 public function editNavigation()
 {
     if (Request::param('mode') == 'multi') {
         return '';
     }
     return self::editPrevLink($this->Activity->id(), $this->Activity->timestamp()) . self::editNextLink($this->Activity->id(), $this->Activity->timestamp());
 }
Example #5
0
 /**
  * @param \Runalyze\Model\Activity\Entity $activity
  * @param \Runalyze\Model\Route\Entity $route
  * @param int $offset
  * @return \Runalyze\Calculation\NightDetector $this-reference
  */
 public function setFromEntities(Activity\Entity $activity, Route\Entity $route, $offset = 0)
 {
     if ($route->hasGeohashes() && $route->get(Route\Entity::STARTPOINT) != '') {
         $timestamp = $activity->timestamp() + 0.5 * $activity->duration();
         $coordinate = (new Geohash())->decode($route->get(Route\Entity::STARTPOINT))->getCoordinate();
         $this->setFrom($timestamp, $coordinate, $offset);
     } else {
         $this->Value = null;
     }
     return $this;
 }
Example #6
0
 /**
  * Date
  * @return string
  */
 public function date()
 {
     return date('d.m.Y', $this->Activity->timestamp());
 }