/**
  * @param \Runalyze\Model\InserterWithAccountID $inserter
  * @return int
  */
 protected function runInserter(\Runalyze\Model\InserterWithAccountID $inserter, $return = true)
 {
     $inserter->setAccountID(0);
     $inserter->insert();
     if ($return) {
         return $inserter->insertedID();
     }
 }
Esempio n. 2
0
 /**
  * Tasks before insertion
  */
 protected function before()
 {
     parent::before();
     $Calculator = new Calculator($this->Object);
     if (Configuration::ActivityForm()->correctElevation() && !$this->Object->hasCorrectedElevations()) {
         $Calculator->tryToCorrectElevation();
     }
     $Calculator->calculateElevation();
 }
Esempio n. 3
0
 /**
  * Tasks before insertion
  */
 protected function before()
 {
     parent::before();
     $this->Object->set(Object::TIMESTAMP_CREATED, time());
     $this->removeDataIfInside();
     $this->calculateCaloriesIfZero();
     $this->calculateVDOTAndIntensityAndTrimp();
     $this->calculatePower();
     $this->calculateStrideLength();
 }
Esempio n. 4
0
 /**
  * Tasks before insertion
  */
 protected function before()
 {
     parent::before();
     $Calculator = new Calculator($this->Object);
     if (Configuration::ActivityForm()->correctElevation() && !$this->Object->hasCorrectedElevations()) {
         try {
             $Calculator->tryToCorrectElevation();
         } catch (NoValidStrategyException $e) {
             // Well, obviously that did not work. Probably all API limits have been reached.
         }
     }
     $Calculator->calculateElevation();
 }
Esempio n. 5
0
 /**
  * Construct inserter
  * @param \PDO $connection
  * @param \Runalyze\Model\Trackdata\Object $object [optional]
  */
 public function __construct(\PDO $connection, Object $object = null)
 {
     parent::__construct($connection, $object);
 }
Esempio n. 6
0
 /**
  * Tasks before insertion
  */
 protected function before()
 {
     $this->calculateIfActivityWasAtNight();
     parent::before();
     $this->Object->set(Entity::TIMESTAMP_CREATED, time());
     $this->setSportIdIfEmpty();
     $this->removeDataIfInside();
     $this->calculateCaloriesIfZero();
     $this->calculateVDOTAndIntensityAndTrimp();
     $this->calculatePower();
     $this->calculateStrideLength();
     $this->calculateVerticalRatio();
     $this->calculateSwimValues();
 }