PMCORE-3553

This commit is contained in:
Paula Quispe
2021-12-03 18:37:03 -04:00
parent 5c4787ac20
commit 1a48d77c96
5 changed files with 19 additions and 8 deletions

View File

@@ -17,6 +17,7 @@ $factory->define(\ProcessMaker\Model\Task::class, function(Faker $faker) {
'TAS_DURATION' => 1, 'TAS_DURATION' => 1,
'TAS_ASSIGN_TYPE' => 'BALANCED', 'TAS_ASSIGN_TYPE' => 'BALANCED',
'TAS_DEF_TITLE' => $faker->sentence(2), 'TAS_DEF_TITLE' => $faker->sentence(2),
'TAS_DEF_DESCRIPTION' => $faker->sentence(2),
'TAS_ASSIGN_VARIABLE' => '@@SYS_NEXT_USER_TO_BE_ASSIGNED', 'TAS_ASSIGN_VARIABLE' => '@@SYS_NEXT_USER_TO_BE_ASSIGNED',
'TAS_MI_INSTANCE_VARIABLE' => '@@SYS_VAR_TOTAL_INSTANCE', 'TAS_MI_INSTANCE_VARIABLE' => '@@SYS_VAR_TOTAL_INSTANCE',
'TAS_MI_COMPLETE_VARIABLE' => '@@SYS_VAR_TOTAL_INSTANCES_COMPLETE', 'TAS_MI_COMPLETE_VARIABLE' => '@@SYS_VAR_TOTAL_INSTANCES_COMPLETE',
@@ -47,6 +48,7 @@ $factory->state(\ProcessMaker\Model\Task::class, 'foreign_keys', function (Faker
'TAS_DURATION' => 1, 'TAS_DURATION' => 1,
'TAS_ASSIGN_TYPE' => 'BALANCED', 'TAS_ASSIGN_TYPE' => 'BALANCED',
'TAS_DEF_TITLE' => $faker->sentence(2), 'TAS_DEF_TITLE' => $faker->sentence(2),
'TAS_DEF_DESCRIPTION' => $faker->sentence(2),
'TAS_ASSIGN_VARIABLE' => '@@SYS_NEXT_USER_TO_BE_ASSIGNED', 'TAS_ASSIGN_VARIABLE' => '@@SYS_NEXT_USER_TO_BE_ASSIGNED',
'TAS_MI_INSTANCE_VARIABLE' => '@@SYS_VAR_TOTAL_INSTANCE', 'TAS_MI_INSTANCE_VARIABLE' => '@@SYS_VAR_TOTAL_INSTANCE',
'TAS_MI_COMPLETE_VARIABLE' => '@@SYS_VAR_TOTAL_INSTANCES_COMPLETE', 'TAS_MI_COMPLETE_VARIABLE' => '@@SYS_VAR_TOTAL_INSTANCES_COMPLETE',

View File

@@ -3425,7 +3425,7 @@ class DelegationTest extends TestCase
public function it_get_thread_title() public function it_get_thread_title()
{ {
$delegation = factory(Delegation::class)->states('foreign_keys')->create(); $delegation = factory(Delegation::class)->states('foreign_keys')->create();
$result = Delegation::getThreadTitle($delegation->TAS_UID, $delegation->APP_NUMBER, $delegation->DEL_INDEX, []); $result = Delegation::getThreadTitle($delegation->TAS_UID, $delegation->APP_NUMBER, $delegation->DEL_PREVIOUS, []);
$this->assertNotEmpty($result); $this->assertNotEmpty($result);
} }
@@ -3584,6 +3584,19 @@ class DelegationTest extends TestCase
$this->assertNotEmpty($result); $this->assertNotEmpty($result);
} }
/**
* This check the return cases thread title
*
* @covers \ProcessMaker\Model\Delegation::casesThreadTitle()
* @test
*/
public function it_get_cases_thread_title()
{
$delegation = factory(Delegation::class)->states('foreign_keys')->create();
$result = Delegation::casesThreadTitle($delegation->DEL_TITLE);
$this->assertNotEmpty($result);
}
/** /**
* Test the scopeParticipatedUser * Test the scopeParticipatedUser
* *

View File

@@ -68,7 +68,7 @@ class Participated extends AbstractCases
// Specific case title // Specific case title
if (!empty($this->getCaseTitle())) { if (!empty($this->getCaseTitle())) {
// Get the result // Get the result
$result = Delegation::casesThreadTitle($this->getCaseTitle(), $this->getOffset(), $this->getLimit()); $result = Delegation::casesThreadTitle($this->getCaseTitle());
// Add the filter // Add the filter
$query->specificCases($result); $query->specificCases($result);
} }

View File

@@ -66,7 +66,7 @@ class Supervising extends AbstractCases
// Specific case title // Specific case title
if (!empty($this->getCaseTitle())) { if (!empty($this->getCaseTitle())) {
// Get the result // Get the result
$result = Delegation::casesThreadTitle($this->getCaseTitle(), $this->getOffset(), $this->getLimit()); $result = Delegation::casesThreadTitle($this->getCaseTitle());
// Add the filter // Add the filter
$query->specificCases($result); $query->specificCases($result);
} }

View File

@@ -2181,12 +2181,10 @@ class Delegation extends Model
* Get cases filter by thread title * Get cases filter by thread title
* *
* @param string $search * @param string $search
* @param int $offset
* @param int $limit
* *
* @return array * @return array
*/ */
public static function casesThreadTitle(string $search, int $offset = 0, int $limit = 15) public static function casesThreadTitle(string $search)
{ {
// Get the case numbers related to this filter // Get the case numbers related to this filter
$query = Delegation::query()->select(['APP_NUMBER']); $query = Delegation::query()->select(['APP_NUMBER']);
@@ -2194,8 +2192,6 @@ class Delegation extends Model
$query->title($search); $query->title($search);
// Group by // Group by
$query->groupBy('APP_NUMBER'); $query->groupBy('APP_NUMBER');
// Apply the limit
$query->offset($offset)->limit($limit);
// Get the result // Get the result
$results = $query->get(); $results = $query->get();