Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Middle name now part of the full_name creation #754

Merged
merged 1 commit into from
Nov 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions app/Repositories/PeopleRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,7 @@ public function getFields()
'Suffix',
'Honorific',
'First Name',
'Middle Name',
'Last Name',
'Picture',
'Photo Download',
Expand All @@ -342,6 +343,7 @@ public function getFields()
'name_fields' => [
'Honorific',
'First Name',
'Middle Name',
'Last Name',
'Suffix',
],
Expand Down
2 changes: 2 additions & 0 deletions app/Repositories/ProfileRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,7 @@ public function getFields()
'Suffix',
'Honorific',
'First Name',
'Middle name',
'Last Name',
'Picture',
'Photo Download',
Expand All @@ -324,6 +325,7 @@ public function getFields()
'name_fields' => [
'Honorific',
'First Name',
'Middle name',
'Last Name',
'Suffix',
],
Expand Down
13 changes: 12 additions & 1 deletion factories/People.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ public function create($limit = 1, $flatten = false, $options = [])
for ($i = 1; $i <= $limit; $i++) {
$accessid = $this->faker->randomLetter().$this->faker->randomLetter().$this->faker->randomNumber(4, true);
$first_name = $this->faker->firstName();
$middle_name = $this->faker->firstName();
$last_name = $this->faker->lastName();
$suffix = $this->faker->suffix();
$email = $this->faker->email();
Expand All @@ -46,6 +47,7 @@ public function create($limit = 1, $flatten = false, $options = [])
$data[$i] = [
'id' => $i,
'first_name' => $first_name,
'middle_name' => $middle_name,
'last_name' => $last_name,
'accessid' => $accessid,
'email' => $email,
Expand All @@ -64,6 +66,14 @@ public function create($limit = 1, $flatten = false, $options = [])
'global' => 1,
],
],
[
'value' => $middle_name,
'field' => [
'name' => 'Middle Name',
'type' => 'text',
'global' => 1,
],
],
[
'value' => $last_name,
'field' => [
Expand Down Expand Up @@ -141,10 +151,11 @@ public function create($limit = 1, $flatten = false, $options = [])
$groups->random(),
],
'link' => '/styleguide/profile/aa0000',
'full_name' => $first_name . ' ' . $last_name,
'full_name' => $first_name . ' ' . $middle_name . ' ' . $last_name,
'data' => [
'AccessID' => $accessid,
'First Name' => $first_name,
'Middle Name' => $middle_name,
'Last Name' => $last_name,
'Email' => $email,
'Title' => $this->faker->sentence(3),
Expand Down
2 changes: 1 addition & 1 deletion resources/views/contact-tables.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
<tbody>
@foreach($profile_list as $profile)
<tr>
<td>@if(isset($profile['data']['Email']))<a href="mailto:{{$profile['data']['Email']}}">@endif{{$profile['data']['First Name']}} {{$profile['data']['Last Name']}}@if(isset($profile['data']['Email']))</a>@endif</td>
<td>@if(isset($profile['data']['Email']))<a href="mailto:{{$profile['data']['Email']}}">@endif{{$profile['full_name']}}@if(isset($profile['data']['Email']))</a>@endif</td>
<td>@if(isset($profile['data']['Title'])){{$profile['data']['Title']}}@endif</td>
<td>@if(isset($profile['data']['Office Location'])){{$profile['data']['Office Location']}}@endif</td>
<td>@if(isset($profile['data']['Phone'])){{$profile['data']['Phone']}}@endif</td>
Expand Down
4 changes: 3 additions & 1 deletion tests/Unit/Repositories/PeopleRepositoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ public function getting_page_title_should_come_from_name(): void
'name_fields' => [
'Honorific',
'First Name',
'Middle Name',
'Last Name',
'Suffix',
],
Expand All @@ -60,6 +61,7 @@ public function getting_page_title_should_come_from_name(): void
$return['profile']['data'] = [
'Honorific' => 'Dr.',
'First Name' => 'Anthony',
'Middle Name' => 'M.',
'Last Name' => 'Wayne',
'Suffix' => 'Jr.',
];
Expand All @@ -72,7 +74,7 @@ public function getting_page_title_should_come_from_name(): void
$pageTitle = $people->getPageTitleFromName($return);

// Make sure the page title equals all the name fields
$this->assertEquals('Dr. Anthony Wayne, Jr.', $pageTitle);
$this->assertEquals('Dr. Anthony M. Wayne, Jr.', $pageTitle);
}

#[Test]
Expand Down
4 changes: 3 additions & 1 deletion tests/Unit/Repositories/ProfileRepositoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ public function getting_page_title_should_come_from_name(): void
'name_fields' => [
'Honorific',
'First Name',
'Middle name',
'Last Name',
'Suffix',
],
Expand All @@ -60,6 +61,7 @@ public function getting_page_title_should_come_from_name(): void
$return['profile']['data'] = [
'Honorific' => 'Dr.',
'First Name' => 'Anthony',
'Middle name' => 'M.',
'Last Name' => 'Wayne',
'Suffix' => 'Jr.',
];
Expand All @@ -72,7 +74,7 @@ public function getting_page_title_should_come_from_name(): void
$pageTitle = $profile->getPageTitleFromName($return);

// Make sure the page title equals all the name fields
$this->assertEquals('Dr. Anthony Wayne, Jr.', $pageTitle);
$this->assertEquals('Dr. Anthony M. Wayne, Jr.', $pageTitle);
}

#[Test]
Expand Down
Loading