/**
  * @param array $data
  * @param array $route
  * @param array $trackdata
  * @return int
  */
 protected function insertActivity(array $data, array $route, array $trackdata)
 {
     $Inserter = new Inserter($this->PDO, new Object($data));
     $Inserter->setRoute(new Route\Object($route));
     $Inserter->setTrackdata(new Trackdata\Object($trackdata));
     return $this->runInserter($Inserter);
 }
Beispiel #2
0
 public function testPowerCalculation()
 {
     // TODO: Needs configuration setting
     if (Configuration::ActivityForm()->computePower()) {
         $ActivityIndoor = new Object(array(Object::DISTANCE => 10, Object::TIME_IN_SECONDS => 3000, Object::SPORTID => $this->IndoorID));
         $Trackdata = new Model\Trackdata\Object(array(Model\Trackdata\Object::TIME => array(1500, 3000), Model\Trackdata\Object::DISTANCE => array(5, 10)));
         $Inserter = new Inserter($this->PDO);
         $Inserter->setAccountID(0);
         $Inserter->setTrackdata($Trackdata);
         $Inserter->insert($ActivityIndoor);
         $this->assertEquals(0, $this->fetch($Inserter->insertedID())->power());
         $ActivityOutdoor = clone $ActivityIndoor;
         $ActivityOutdoor->set(Object::SPORTID, $this->OutdoorID);
         $Inserter->insert($ActivityOutdoor);
         $this->assertNotEquals(0, $this->fetch($Inserter->insertedID())->power());
         $this->assertNotEmpty($Trackdata->power());
     }
 }