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

Added zipcode and birthdate to event signup export (issue #300) #396

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ThijsEgberts
Copy link
Contributor

Added zipcode and birthdate to event signup export
#300

Copy link

codecov bot commented Dec 3, 2024

Codecov Report

Attention: Patch coverage is 0% with 5 lines in your changes missing coverage. Please review.

Project coverage is 30.06%. Comparing base (5284624) to head (8d1c5b5).

Files with missing lines Patch % Lines
app/Services/AgendaApplicationFormService.php 0.00% 3 Missing ⚠️
app/Exports/AgendaRegistrationExport.php 0.00% 2 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master     #396      +/-   ##
============================================
- Coverage     30.13%   30.06%   -0.08%     
  Complexity      529      529              
============================================
  Files            80       80              
  Lines          2014     2019       +5     
============================================
  Hits            607      607              
- Misses         1407     1412       +5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@marijnvanderhorst marijnvanderhorst self-assigned this Dec 3, 2024
Comment on lines +148 to +149
//format birthday to not include the time of day
$userline["birthDay"] = substr($userline["birthDay"], 0, 10);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd suggest performing this attribute formatting in the User model instead. There, we can firsts add

protected $casts = [
    'birthDay' => 'date',
];

This will ensure the birthDay attribute is always type-casted to a Carbon instance.

Then, I'd suggest defining an accessor to retrieve the "formatted birthday", as follows.

public function birthdayFormatted(): Attribute
{
    return Attribute::make(
        get: fn () => $this->birthDay->format('Y-m-d'),
    );
}

Note that the formatted birthday value can now simply be retrieved using $user->birthdayFormatted (not calling the function, but relying on the new property that will be magically added by the framework) or $user['birthdayFormatted'] whenever we have an instance of the user model.

"email",
"phonenumber",
"birthDay",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then, this would need to be changed to the birthdayFormatted property instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants