Update task time spent based on subtasks time spent
This commit is contained in:
@@ -307,17 +307,13 @@ class SubtaskTimeTracking extends Base
|
|||||||
->eq('end', 0)
|
->eq('end', 0)
|
||||||
->findOneColumn('start');
|
->findOneColumn('start');
|
||||||
|
|
||||||
$time_spent = $this->db
|
$subtask = $this->subtask->getById($subtask_id);
|
||||||
->table(Subtask::TABLE)
|
|
||||||
->eq('id', $subtask_id)
|
|
||||||
->findOneColumn('time_spent');
|
|
||||||
|
|
||||||
return $start_time &&
|
return $start_time &&
|
||||||
$this->db
|
$this->subtask->update(array( // Fire the event subtask.update
|
||||||
->table(Subtask::TABLE)
|
'id' => $subtask['id'],
|
||||||
->eq('id', $subtask_id)
|
'time_spent' => $subtask['time_spent'] + round((time() - $start_time) / 3600, 1),
|
||||||
->update(array(
|
'task_id' => $subtask['task_id'],
|
||||||
'time_spent' => $time_spent + round((time() - $start_time) / 3600, 1)
|
));
|
||||||
));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
<table class="table-fixed">
|
<table class="table-fixed">
|
||||||
<tr>
|
<tr>
|
||||||
<th class="column-20"><?= $subtask_paginator->order(t('User'), 'username') ?></th>
|
<th class="column-20"><?= $subtask_paginator->order(t('User'), 'username') ?></th>
|
||||||
<th class="column-40"><?= $subtask_paginator->order(t('Subtask'), 'subtask_title') ?></th>
|
<th class="column-30"><?= $subtask_paginator->order(t('Subtask'), 'subtask_title') ?></th>
|
||||||
<th><?= $subtask_paginator->order(t('Start'), 'start') ?></th>
|
<th><?= $subtask_paginator->order(t('Start'), 'start') ?></th>
|
||||||
<th><?= $subtask_paginator->order(t('End'), 'end') ?></th>
|
<th><?= $subtask_paginator->order(t('End'), 'end') ?></th>
|
||||||
</tr>
|
</tr>
|
||||||
|
|||||||
Reference in New Issue
Block a user