* added doctrine listener to calculate duration on each update #31 * added constraints to base objects #31 * new form to create timesheet entries #31 * added unit test for TimesheetVoter #31
This commit is contained in:
@@ -40,13 +40,7 @@ class TimesheetRepository extends AbstractRepository
|
||||
*/
|
||||
public function stopRecording(Timesheet $entry)
|
||||
{
|
||||
$end = new DateTime();
|
||||
$begin = $entry->getBegin();
|
||||
|
||||
$entry->setEnd($end);
|
||||
$entry->setDuration($end->getTimestamp() - $begin->getTimestamp());
|
||||
|
||||
// TODO calculate rate by users hourly rate
|
||||
$entry->setEnd(new DateTime());
|
||||
|
||||
$entityManager = $this->getEntityManager();
|
||||
$entityManager->persist($entry);
|
||||
|
||||
Reference in New Issue
Block a user