Merged in bugfix/PMCORE-3087 (pull request #7987)
PMCORE-3087 Approved-by: Julio Cesar Laura Avendaño
This commit is contained in:
@@ -2051,4 +2051,54 @@ class Delegation extends Model
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get cases completed by specific user
|
||||
*
|
||||
* @param int $userId
|
||||
* @param int $offset
|
||||
* @param int $limit
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function casesCompletedBy(int $userId, int $offset = 0, int $limit = 15)
|
||||
{
|
||||
// Get the case numbers related to this filter
|
||||
$query = Delegation::query()->select(['APP_NUMBER']);
|
||||
// Filter the user
|
||||
$query->participated($userId);
|
||||
// Filter the last thread
|
||||
$query->lastThread();
|
||||
// Apply the limit
|
||||
$query->offset($offset)->limit($limit);
|
||||
// Get the result
|
||||
$results = $query->get();
|
||||
|
||||
return $results->values()->toArray();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get cases started by specific user
|
||||
*
|
||||
* @param int $userId
|
||||
* @param int $offset
|
||||
* @param int $limit
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function casesStartedBy(int $userId, int $offset = 0, int $limit = 15)
|
||||
{
|
||||
// Get the case numbers related to this filter
|
||||
$query = Delegation::query()->select(['APP_NUMBER']);
|
||||
// Filter the user
|
||||
$query->participated($userId);
|
||||
// Filter the first thread
|
||||
$query->caseStarted();
|
||||
// Apply the limit
|
||||
$query->offset($offset)->limit($limit);
|
||||
// Get the result
|
||||
$results = $query->get();
|
||||
|
||||
return $results->values()->toArray();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user