Esempio n. 1
0
 public function testForBock()
 {
     $Strategy = new Bock();
     $this->object->setStrategy($Strategy);
     $this->assertEquals($Strategy->inSeconds(5), $this->object->inSeconds(5));
     $this->assertEquals($Strategy->inSeconds(10), $this->object->inSeconds(10));
     $this->assertEquals($Strategy->inSeconds(21.1), $this->object->inSeconds(21.1));
     $this->assertEquals($Strategy->inSeconds(42.2), $this->object->inSeconds(42.2));
 }
    /**
     * Show prognosis for a given distance
     * @param double $distance
     */
    protected function showPrognosis($distance)
    {
        $PB = new PersonalBest($distance);
        $PBTime = $PB->exists() ? Duration::format($PB->seconds()) : '-';
        $Prognosis = new Duration($this->Prognosis->inSeconds($distance));
        $Distance = new Distance($distance);
        $Pace = new Pace($Prognosis->seconds(), $distance, Pace::MIN_PER_KM);
        echo '<p>
				<span class="right">
					' . sprintf(__('<small>from</small> %s <small>to</small> <strong>%s</strong>'), $PBTime, $Prognosis->string(Duration::FORMAT_AUTO, 0)) . '
					<small>(' . $Pace->valueWithAppendix() . ')</small>
				</span>
				<strong>' . $Distance->string(Distance::FORMAT_AUTO, 1) . '</strong>
			</p>';
    }
    /**
     * Show prognosis for a given distance
     * @param double $distance
     */
    protected function showPrognosis($distance)
    {
        $PB = new PersonalBest($distance);
        $PB->lookupWithDetails();
        $PBTime = $PB->exists() ? Duration::format($PB->seconds()) : '-';
        $PBString = $PB->exists() ? Ajax::trainingLink($PB->activityId(), $PBTime, true) : $PBTime;
        $Prognosis = new Duration($this->Prognosis->inSeconds($distance));
        $Distance = new Distance($distance);
        $Pace = new Pace($Prognosis->seconds(), $distance, SportFactory::getSpeedUnitFor(Configuration::General()->runningSport()));
        echo '<p>
				<span class="right">
					' . sprintf(__('<small>from</small> %s <small>to</small> <strong>%s</strong>'), $PBString, $Prognosis->string(Duration::FORMAT_AUTO, 0)) . '
					<small>(' . $Pace->valueWithAppendix() . ')</small>
				</span>
				<strong>' . $Distance->stringAuto(true, 1) . '</strong>
			</p>';
    }