コード例 #1
0
 /**
  * Remove single series from trackdata
  * @param enum $key
  */
 public function removeFromTrackdata($key)
 {
     if (isset($this->ActivityKeysForTrackdataKeys[$key])) {
         $this->removeFromActivityIfValueIsEqualToAverage($key, $this->ActivityKeysForTrackdataKeys[$key]);
     }
     $this->Trackdata->set($key, array());
 }
コード例 #2
0
ファイル: Updater.php プロジェクト: rob-st/Runalyze
 /**
  * Update power for trackdata
  * @param array $powerData
  */
 protected function updatePowerForTrackdata(array $powerData)
 {
     if (null !== $this->Trackdata && (empty($powerData) && $this->Trackdata->has(Model\Trackdata\Entity::POWER) || !empty($powerData) && !$this->Trackdata->has(Model\Trackdata\Entity::POWER))) {
         $this->Trackdata->set(Model\Trackdata\Entity::POWER, $powerData);
         $TrackdataUpdater = new Model\Trackdata\Updater($this->PDO);
         $TrackdataUpdater->setAccountID($this->AccountID);
         $TrackdataUpdater->update($this->Trackdata, array(Model\Trackdata\Entity::POWER));
     }
 }
コード例 #3
0
ファイル: Inserter.php プロジェクト: rob-st/Runalyze
 /**
  * Calculate power
  */
 protected function calculatePower()
 {
     if (\Runalyze\Context::Factory()->sport($this->Object->sportid())->hasPower() && Configuration::ActivityForm()->computePower() && null !== $this->Trackdata) {
         $Calculator = new \Runalyze\Calculation\Power\Calculator($this->Trackdata, $this->Route);
         $Calculator->calculate();
         $this->Trackdata->set(Model\Trackdata\Entity::POWER, $Calculator->powerData());
         $this->Object->set(Entity::POWER, $Calculator->average());
     }
 }
コード例 #4
0
ファイル: ActivitySeries.php プロジェクト: rob-st/Runalyze
 /**
  * Init data
  * @param \Runalyze\Model\Trackdata\Entity $trackdata
  * @param string $key
  */
 protected function fillGaps(Trackdata $trackdata, $key)
 {
     $data = $trackdata->get($key);
     $last = $data[0];
     foreach ($data as &$val) {
         if ($val == 0) {
             $val = $last;
         }
         $last = $val;
     }
     $trackdata->set($key, $data);
 }
コード例 #5
0
 /**
  * Construct time series for trackdata object
  * @param \Runalyze\Model\Trackdata\Entity $trackdata
  * @param int $indexKey enum
  * @param int[] $sumDifferencesKeys enums
  * @param int[] $avgValuesKeys enums
  * @throws \InvalidArgumentException
  */
 public function __construct(Trackdata\Entity $trackdata, $indexKey, $sumDifferencesKeys = array(), $avgValuesKeys = array())
 {
     $this->Trackdata = $trackdata;
     $this->IndexKey = $indexKey;
     $this->SumDifferencesKeys = $sumDifferencesKeys;
     $this->AvgValuesKeys = $avgValuesKeys;
     foreach (array_merge($sumDifferencesKeys, $avgValuesKeys) as $key) {
         if (!$trackdata->has($key)) {
             $trackdata->set($key, array_fill(0, $trackdata->num(), 0));
         }
     }
     parent::__construct($trackdata->get($indexKey), $trackdata->get(Trackdata\Entity::TIME));
     $this->collectData();
 }
コード例 #6
0
ファイル: Entity.php プロジェクト: rob-st/Runalyze
 public function fillDistanceArray(Trackdata\Entity &$trackdata)
 {
     if ($this->poollength() && !$trackdata->has(Trackdata\Entity::DISTANCE)) {
         $distance = range($this->poollength() / 100000, $this->num() * $this->poollength() / 100000, $this->poollength() / 100000);
         $trackdata->set(Trackdata\Entity::DISTANCE, $distance);
     }
 }