Merged in feature/PMCORE-3133 (pull request #7995)

PMCORE-3133

Approved-by: Julio Cesar Laura Avendaño
This commit is contained in:
Andrea Adamczyk
2021-07-22 13:14:33 +00:00
committed by Julio Cesar Laura Avendaño
6 changed files with 405 additions and 0 deletions

View File

@@ -66,4 +66,45 @@ class Metrics extends Api
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
}
}
/**
* Get total cases by range
*
* @url /process-total-cases
*
* @param string $caseList
* @param int $processId
* @param string $dateFrom
* @param string $dateTo
* @param string $groupBy
*
* @return array
*
* @throws RestException
*
* @class AccessControl {@permission TASK_METRICS_VIEW}
*/
public function getTotalCasesByRange($caseList, $processId = null, $dateFrom = null, $dateTo = null, $groupBy = 'day')
{
try {
switch ($caseList) {
case 'inbox':
$list = new Inbox();
break;
case 'draft':
$list = new Draft();
break;
case 'paused':
$list = new Paused();
break;
case 'unassigned':
$list = new Unassigned();
break;
}
$result = $list->getCountersByRange($processId, $dateFrom, $dateTo, $groupBy);
return $result;
} catch (Exception $e) {
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
}
}
}