Total Subtask Progress Percentage in Task

Hello all, I’m going mental trying to figure this out. I’m trying to duplicate the xx% completion of the subtasks in the board task footer to the top of the task page.

The total number of subtasks for the displayed task is shown fine… but the progress completed does not show the same figure as on the board.

I know the problem is nb_completed_subtasks and nb_subtasks but I just dont know how to call them.

I’m using the metamagik plugin template, as adding the info to the task summary.

Looking at the above pic, the count of subtasks is fine, but the 100% shows only because subtasks are in progress and running but the NAN% is wrong obviously.

Can anyone help?

<!-- SUBTASKS -->
                    <?php $subtasks = $this->model->subtaskModel->getAll($task['id']); ?>
                    <?php $nb_completed_subtasks = $this->model->taskFinderModel->getExtendedQuery();
                    $nb_subtasks = $this->model->taskFinderModel->getExtendedQuery(); ?>
                    <?php if (! empty($subtasks)): ?>
                        <li class="task-general-summary-item">
                            <span class="task-general-summary-title"><i class="fa fa-tasks pp-grey"></i> Subtasks:</span>
                            <span class=""><?= count($subtasks) ?></span>
                            <?= $this->task->getProgress($subtasks).'%' ?>
                            <span class="" title=""><?= round($task['nb_completed_subtasks'] / $task['nb_subtasks'] * 100, 0).'%' ?></span>
                            <span class="" title=""><?= round($nb_completed_subtasks / $nb_subtasks * 100, 0).'%' ?></span>
                        </li>
                    <?php endif ?>
1 Like