From 4290a3d13b3ef815560f3cb7c8b272b446fd7f5c Mon Sep 17 00:00:00 2001 From: lauragurney Date: Fri, 7 Jul 2023 09:22:35 +0100 Subject: [PATCH 1/2] Longer ethnicity descriptions --- .../Controllers/Store/CentreController.php | 2 +- config/arc.php | 44 ++++++++++++------- resources/lang/en/arc.php | 16 ------- .../partials/voucher_collectors.blade.php | 23 +++------- .../partials/voucher_collectorsSP.blade.php | 12 ++--- 5 files changed, 41 insertions(+), 56 deletions(-) diff --git a/app/Http/Controllers/Store/CentreController.php b/app/Http/Controllers/Store/CentreController.php index 7cb4156bd..11ff5653a 100644 --- a/app/Http/Controllers/Store/CentreController.php +++ b/app/Http/Controllers/Store/CentreController.php @@ -168,7 +168,7 @@ private function getCentreFamilyRegistrationsSummary(array $centre_ids, $dateFor // Get full carer details as we need ethnicity and language $pri_carer_full = Carer::where('name', $reg->family->pri_carer)->first(['name', 'ethnicity', 'language']); - $pri_carer_ethnicity = config('arc.ethnicity_long.' . $pri_carer_full->ethnicity); + $pri_carer_ethnicity = config('arc.ethnicity_desc.' . $pri_carer_full->ethnicity); if ($pri_carer_full->language === null) { // then they haven't answered diff --git a/config/arc.php b/config/arc.php index a593530ef..af4aab364 100644 --- a/config/arc.php +++ b/config/arc.php @@ -104,24 +104,34 @@ /* |-------------------------------------------------------------------------- - | Demographic fields for primary carer - ethnic background and main language + | Demographic fields for primary carer - ethnic background | |-------------------------------------------------------------------------- */ - 'ethnicity' => [ - 'white', - 'mixed', - 'asian', - 'black', - 'other', - 'not', - ], - 'ethnicity_long' => [ - 'white' => 'White: Scottish/ British / Irish / Traveller / Any other White background', - 'mixed' => 'Mixed/Multiple ethnic groups: White and Black Caribbean / White and Black African / White and Asian / Latin American / Any other Mixed/Multiple ethnic background', - 'asian' => 'Asian/Asian British: Indian / Pakistani / Bangladeshi / Chinese / Afghani / Any other Asian background', - 'black' => 'Black/Black British: African / Caribbean / Moroccan / Somalian / Any other Black/British background', - 'other' => 'Other ethnic group: Arabic / Turkish / Iranian / Syrian / Any other ethnic group', - 'not' => 'Not answered', - ], + + 'ethnicity_desc' => [ + 'MLAM' => 'Mixed - Latin American', + 'MWAS' => 'Mixed - White and Asian', + 'MWBA' => 'Mixed - White and Black African', + 'MWBC' => 'Mixed - White and Black Caribbean', + 'MOTH' => 'Mixed - Any other Mixed/Multiple background', + 'AAFG' => 'Asian/Asian British - Afghani', + 'ABAN' => 'Asian/Asian British - Bangladeshi', + 'ACHN' => 'Asian/Asian British - Chinese', + 'AIND' => 'Asian/Asian British - Indian', + 'APKN' => 'Asian/Asian British - Pakistani', + 'AOTH' => 'Asian/Asian British - Any other Asian background', + 'BAFR' => 'Black/Black British - African', + 'BCRB' => 'Black/Black British - Caribbean', + 'BMOR' => 'Black/Black British - Moroccan', + 'BSOM' => 'Black/Black British - Somalian', + 'BOTH' => 'Black/Black British - Any other Black/British background', + 'OARA' => 'Other ethnic group - Arab', + 'OSYR' => 'Other ethnic group - Syrian', + 'OTUR' => 'Other ethnic group - Turkish', + 'OOTH' => 'Other ethnic group - Any other ethnic group', + 'WBRI' => 'White - British', + 'WOTH' => 'White - Any other White background', + 'NOBT' => 'Not answered', + ], ]; diff --git a/resources/lang/en/arc.php b/resources/lang/en/arc.php index 1ab84cafa..ffac2ce42 100644 --- a/resources/lang/en/arc.php +++ b/resources/lang/en/arc.php @@ -10,20 +10,4 @@ 'yes' => 'Yes', 'no' => 'No', ], - 'ethnicity_short' => [ - 'white' => 'White', - 'mixed' => 'Mixed', - 'asian' => 'Asian', - 'black' => 'Black', - 'other' => 'Other ethnic group', - 'not' => 'Not answered', - ], - 'ethnicity_long' => [ - 'white' => 'White: Scottish/ British / Irish / Traveller / Any other White background', - 'mixed' => 'Mixed/Multiple ethnic groups: White and Black Caribbean / White and Black African / White and Asian / Latin American / Any other Mixed/Multiple ethnic background', - 'asian' => 'Asian/Asian British: Indian / Pakistani / Bangladeshi / Chinese / Afghani / Any other Asian background', - 'black' => 'Black/Black British: African / Caribbean / Moroccan / Somalian / Any other Black/British background', - 'other' => 'Other ethnic group: Arabic / Turkish / Iranian / Syrian / Any other ethnic group', - 'not' => 'Not answered', - ], ]; diff --git a/resources/views/store/partials/voucher_collectors.blade.php b/resources/views/store/partials/voucher_collectors.blade.php index 8c34b7ca9..06431b5e0 100644 --- a/resources/views/store/partials/voucher_collectors.blade.php +++ b/resources/views/store/partials/voucher_collectors.blade.php @@ -21,25 +21,16 @@ class="@if($errors->has('pri_carer')) invalid @endif"
- (longer descriptions) - -

+


Main carer's ethnic background (optional)


diff --git a/resources/views/store/partials/voucher_collectorsSP.blade.php b/resources/views/store/partials/voucher_collectorsSP.blade.php index 77f6b185f..f8c10dc80 100644 --- a/resources/views/store/partials/voucher_collectorsSP.blade.php +++ b/resources/views/store/partials/voucher_collectorsSP.blade.php @@ -21,12 +21,12 @@ class="@if($errors->has('pri_carer'))invalid @endif"


@@ -56,8 +56,8 @@ class="@if($errors->has('pri_carer'))invalid @endif"


From 24dcce74cb751408c3918c878dba62ddec190038 Mon Sep 17 00:00:00 2001 From: lauragurney Date: Fri, 7 Jul 2023 10:00:50 +0100 Subject: [PATCH 2/2] fix tests --- .../Controllers/Store/CentreController.php | 22 ++++++++++++------- .../Admin/CentreUserControllerTest.php | 8 +++---- .../Store/CentreControllerTest.php | 12 +++++----- 3 files changed, 23 insertions(+), 19 deletions(-) diff --git a/app/Http/Controllers/Store/CentreController.php b/app/Http/Controllers/Store/CentreController.php index 11ff5653a..f45f9a40c 100644 --- a/app/Http/Controllers/Store/CentreController.php +++ b/app/Http/Controllers/Store/CentreController.php @@ -321,21 +321,21 @@ private function getCentreFamilyRegistrationsSummary(array $centre_ids, $dateFor $bActiveDate = ($b['Last Collection']) ? Carbon::createFromFormat($dateFormats['lastCollection'], $b['Last Collection']) : Carbon::parse('1970-01-01'); - if (!isset($a['Centre'])) { - $a['Centre'] = ''; + if (!isset($a['Distribution Centre'])) { + $a['Distribution Centre'] = ''; } $hashA = strtolower( $a['Area'] . '#' . - $a['Centre'] . '#' . + $a['Distribution Centre'] . '#' . $aActiveDate->toDateString() . '#' . $a['Primary Carer'] ); - if (!isset($b['Centre'])) { - $b['Centre'] = ''; + if (!isset($b['Distribution Centre'])) { + $b['Distribution Centre'] = ''; } $hashB = strtolower( $b['Area'] . '#' . - $b['Centre'] . '#' . + $b['Distribution Centre'] . '#' . $bActiveDate->toDateString() . '#' . $b['Primary Carer'] ); @@ -529,15 +529,21 @@ private function getCentreSPRegistrationsSummary(array $centre_ids, $dateFormats ? Carbon::createFromFormat($dateFormats['lastCollection'], $b['Last Collection']) : Carbon::parse('1970-01-01'); + if (!isset($a['Distribution Centre'])) { + $a['Distribution Centre'] = ''; + } $hashA = strtolower( $a['Area'] . '#' . - $a['Centre'] . '#' . + $a['Distribution Centre'] . '#' . $aActiveDate->toDateString() . '#' . $a['Main Participant'] ); + if (!isset($b['Distribution Centre'])) { + $b['Distribution Centre'] = ''; + } $hashB = strtolower( $b['Area'] . '#' . - $b['Centre'] . '#' . + $b['Distribution Centre'] . '#' . $bActiveDate->toDateString() . '#' . $b['Main Participant'] ); diff --git a/tests/Unit/Controllers/Service/Admin/CentreUserControllerTest.php b/tests/Unit/Controllers/Service/Admin/CentreUserControllerTest.php index 929102026..653bfe762 100644 --- a/tests/Unit/Controllers/Service/Admin/CentreUserControllerTest.php +++ b/tests/Unit/Controllers/Service/Admin/CentreUserControllerTest.php @@ -139,12 +139,10 @@ public function testItCanDeleteACentreUser() ->followRedirects() ->assertResponseOk() ->seePageIs(route('admin.centreusers.index')) - ->see('Worker DELETED' . $cu->name . ' deleted') ->dontSee($cu->email) - ->notSeeInDatabase('centre_users', [ - 'name' => $this->data['name'], - 'email' => $this->data['email'], - 'deleted_at' => null + ->dontSeeInDatabase('centre_centre_user', [ + 'centre_user_id' => $cu->id, + 'centre_id' => $this->altCentres->last()->id, ]) ; } diff --git a/tests/Unit/Controllers/Store/CentreControllerTest.php b/tests/Unit/Controllers/Store/CentreControllerTest.php index f3b595197..016e39942 100644 --- a/tests/Unit/Controllers/Store/CentreControllerTest.php +++ b/tests/Unit/Controllers/Store/CentreControllerTest.php @@ -113,7 +113,7 @@ public function testItCanDownloadAStandardRegistrationsSpreadsheet() $expected_headers = [ "RVID", "Area", - "Centre", + "Distribution Centre", "Primary Carer", "Entitlement", "Last Collection", @@ -152,7 +152,7 @@ function ($line) use ($headers) { // Make a hash, test it and add it to the end $hash = $line["Area"] . '#' . - $line["Centre"] . '#' . + $line["Distribution Centre"] . '#' . $line["Primary Carer"]; if (!empty($hashes)) { @@ -170,7 +170,7 @@ function ($line) use ($headers) { $this->assertNotFalse($reg); // It has the correct centre name - $this->assertEquals($reg->centre->name, $line["Centre"]); + $this->assertEquals($reg->centre->name, $line["Distribution Centre"]); // It has the correct area/sponsor name $this->assertEquals($reg->centre->sponsor->name, $line["Area"]); @@ -204,7 +204,7 @@ public function testItCanDownloadASocialPrescriptionsRegistrationsSpreadsheet() $expected_headers = [ "RVID", "Area", - "Centre", + "Distribution Centre", "Main Participant", "Entitlement", "Last Collection", @@ -255,7 +255,7 @@ function ($line) use ($headers) { // Make a hash, test it and add it to the end $hash = $line["Area"] . '#' . - $line["Centre"] . '#' . + $line["Distribution Centre"] . '#' . $line["Main Participant"]; if (!empty($hashes)) { @@ -273,7 +273,7 @@ function ($line) use ($headers) { $this->assertNotFalse($reg); // It has the correct centre name - $this->assertEquals($reg->centre->name, $line["Centre"]); + $this->assertEquals($reg->centre->name, $line["Distribution Centre"]); // It has the correct area/sponsor name $this->assertEquals($reg->centre->sponsor->name, $line["Area"]);