mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-29 03:13:40 +01:00
WIP timesheet timers: round duration and total time to full minutes
done because our UI only shows full minutes
This commit is contained in:
parent
69ce014aa6
commit
383dfb9a04
@ -265,6 +265,10 @@ class Events extends Api\Storage\Base
|
|||||||
/**
|
/**
|
||||||
* Evaluate events
|
* Evaluate events
|
||||||
*
|
*
|
||||||
|
* Returned time and offset/duration are always rounded to full minutes, independent of their actual unit!
|
||||||
|
* This is done, as we only show full minutes in the UI, and we want to avoid seconds in timestamps
|
||||||
|
* leading to unexpected results in the minutes display.
|
||||||
|
*
|
||||||
* @param array& $timer array with keys 'start', 'offset' and 'paused'
|
* @param array& $timer array with keys 'start', 'offset' and 'paused'
|
||||||
* @param array $row
|
* @param array $row
|
||||||
* @return int? time in ms for stop or pause events, null for start
|
* @return int? time in ms for stop or pause events, null for start
|
||||||
@ -278,7 +282,7 @@ class Events extends Api\Storage\Base
|
|||||||
}
|
}
|
||||||
elseif ($timer['start'])
|
elseif ($timer['start'])
|
||||||
{
|
{
|
||||||
$timer['offset'] += $time = 1000 * ($row['tse_time']->getTimestamp() - $timer['start']->getTimestamp());
|
$timer['offset'] += $time = 60000 * round(($row['tse_time']->getTimestamp() - $timer['start']->getTimestamp())/60);
|
||||||
$timer['start'] = null;
|
$timer['start'] = null;
|
||||||
$timer['paused'] = ($row['tse_type'] & self::PAUSE) === self::PAUSE;
|
$timer['paused'] = ($row['tse_type'] & self::PAUSE) === self::PAUSE;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user