コード例 #1
0
ファイル: LoggerController.php プロジェクト: ssteele/journal
 /**
  * Calculate recent activity
  */
 private function _calculate_tempo()
 {
     // calculate tempo
     $tempo = new Tempo($this->_date_limit);
     $average_tempo = new TempoAverage($tempo->get());
     $this->_average = $average_tempo->calculate();
 }
コード例 #2
0
ファイル: TempoTest.php プロジェクト: arshanam/journal
 public function test_1_5_weighted_calculation()
 {
     $data = [(object) ['tempo' => '2'], (object) ['tempo' => '1'], (object) ['tempo' => '5'], (object) ['tempo' => '19'], (object) ['tempo' => '8'], (object) ['tempo' => '12'], (object) ['tempo' => '1'], (object) ['tempo' => '6'], (object) ['tempo' => '1'], (object) ['tempo' => '6'], (object) ['tempo' => '4'], (object) ['tempo' => '3'], (object) ['tempo' => '6'], (object) ['tempo' => '1'], (object) ['tempo' => '1'], (object) ['tempo' => '11'], (object) ['tempo' => '12'], (object) ['tempo' => '4'], (object) ['tempo' => '2'], (object) ['tempo' => '15'], (object) ['tempo' => '3'], (object) ['tempo' => '11'], (object) ['tempo' => '11'], (object) ['tempo' => '1'], (object) ['tempo' => '7'], (object) ['tempo' => '3'], (object) ['tempo' => '12'], (object) ['tempo' => '8']];
     $tempo = new Tempo(28);
     $tempo_average = new TempoAverage($tempo->mock($data));
     $this->assertEquals(4.65, $tempo_average->calculate());
 }