Time spent for subtasks are not rounded too the nearest quarter anymore
This commit is contained in:
@@ -24,6 +24,10 @@ Improvements:
|
|||||||
* Show project name in task forms
|
* Show project name in task forms
|
||||||
* Convert vanilla CSS to SASS
|
* Convert vanilla CSS to SASS
|
||||||
|
|
||||||
|
Other changes:
|
||||||
|
|
||||||
|
* Time spent (in hours) for subtasks are not rounded too the nearest quarter anymore
|
||||||
|
|
||||||
Bug fixes:
|
Bug fixes:
|
||||||
|
|
||||||
* Fix undefined constant in config example file
|
* Fix undefined constant in config example file
|
||||||
|
|||||||
@@ -239,22 +239,10 @@ class DateParser extends Base
|
|||||||
*/
|
*/
|
||||||
public function getHours(DateTime $d1, DateTime $d2)
|
public function getHours(DateTime $d1, DateTime $d2)
|
||||||
{
|
{
|
||||||
$seconds = $this->getRoundedSeconds(abs($d1->getTimestamp() - $d2->getTimestamp()));
|
$seconds = abs($d1->getTimestamp() - $d2->getTimestamp());
|
||||||
return round($seconds / 3600, 2);
|
return round($seconds / 3600, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Round the timestamp to the nearest quarter
|
|
||||||
*
|
|
||||||
* @access public
|
|
||||||
* @param integer $seconds Timestamp
|
|
||||||
* @return integer
|
|
||||||
*/
|
|
||||||
public function getRoundedSeconds($seconds)
|
|
||||||
{
|
|
||||||
return (int) round($seconds / (15 * 60)) * (15 * 60);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get ISO-8601 date from user input
|
* Get ISO-8601 date from user input
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -41,4 +41,4 @@ Pour chaque sous-tâche, le chrono peut être à tout moment arrêté/démarré
|
|||||||
- Le chrono ne dépend pas du statut de la sous-tâche
|
- Le chrono ne dépend pas du statut de la sous-tâche
|
||||||
- Chaque fois que vous démarrez le chrono, un nouvel enregistrement est créé dans la table de suivi des temps
|
- Chaque fois que vous démarrez le chrono, un nouvel enregistrement est créé dans la table de suivi des temps
|
||||||
- Chaque fois que vous arrêtez l'horloge, la date de fin est enregistrée dans la table de suivi des temps
|
- Chaque fois que vous arrêtez l'horloge, la date de fin est enregistrée dans la table de suivi des temps
|
||||||
- Le temps passé est arrondi au quart d’heure le plus proche
|
- Le temps passé est arrondi au quart d’heure le plus proche (seulement pour Kanboard < 1.0.32)
|
||||||
|
|||||||
@@ -40,4 +40,4 @@ For each subtask, the timer can be stopped/started at any time:
|
|||||||
- The timer doesn't depend of the subtask status
|
- The timer doesn't depend of the subtask status
|
||||||
- Each time you start the timer a new record is created in the time tracking table
|
- Each time you start the timer a new record is created in the time tracking table
|
||||||
- Each time you stop the clock the end date is recorded in the time tracking table
|
- Each time you stop the clock the end date is recorded in the time tracking table
|
||||||
- The calculated time spent is rounded to the nearest quarter
|
- The calculated time spent is rounded to the nearest quarter (only for Kanboard < 1.0.32)
|
||||||
|
|||||||
@@ -166,17 +166,9 @@ class DateParserTest extends Base
|
|||||||
$this->assertEquals(1, $dateParser->getHours(new DateTime('2015-03-14 15:00:00'), new DateTime('2015-03-14 16:00:00')));
|
$this->assertEquals(1, $dateParser->getHours(new DateTime('2015-03-14 15:00:00'), new DateTime('2015-03-14 16:00:00')));
|
||||||
$this->assertEquals(2.5, $dateParser->getHours(new DateTime('2015-03-14 15:00:00'), new DateTime('2015-03-14 17:30:00')));
|
$this->assertEquals(2.5, $dateParser->getHours(new DateTime('2015-03-14 15:00:00'), new DateTime('2015-03-14 17:30:00')));
|
||||||
$this->assertEquals(2.75, $dateParser->getHours(new DateTime('2015-03-14 15:00:00'), new DateTime('2015-03-14 17:45:00')));
|
$this->assertEquals(2.75, $dateParser->getHours(new DateTime('2015-03-14 15:00:00'), new DateTime('2015-03-14 17:45:00')));
|
||||||
$this->assertEquals(3, $dateParser->getHours(new DateTime('2015-03-14 14:57:00'), new DateTime('2015-03-14 17:58:00')));
|
$this->assertEquals(3.02, $dateParser->getHours(new DateTime('2015-03-14 14:57:00'), new DateTime('2015-03-14 17:58:00')));
|
||||||
$this->assertEquals(3, $dateParser->getHours(new DateTime('2015-03-14 14:57:00'), new DateTime('2015-03-14 11:58:00')));
|
$this->assertEquals(2.98, $dateParser->getHours(new DateTime('2015-03-14 14:57:00'), new DateTime('2015-03-14 11:58:00')));
|
||||||
}
|
$this->assertEquals(0, $dateParser->getHours(new DateTime('2015-03-14 14:57:00'), new DateTime('2015-03-14 14:57:10')));
|
||||||
|
|
||||||
public function testRoundSeconds()
|
|
||||||
{
|
|
||||||
$dateParser = new DateParser($this->container);
|
|
||||||
$this->assertEquals('16:30', date('H:i', $dateParser->getRoundedSeconds(strtotime('16:28'))));
|
|
||||||
$this->assertEquals('16:00', date('H:i', $dateParser->getRoundedSeconds(strtotime('16:02'))));
|
|
||||||
$this->assertEquals('16:15', date('H:i', $dateParser->getRoundedSeconds(strtotime('16:14'))));
|
|
||||||
$this->assertEquals('17:00', date('H:i', $dateParser->getRoundedSeconds(strtotime('16:58'))));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGetIsoDate()
|
public function testGetIsoDate()
|
||||||
|
|||||||
Reference in New Issue
Block a user