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

fix: Sort relationship by relationship types #3661

Conversation

ashawe
Copy link

@ashawe ashawe commented Mar 5, 2020

FIX #2395
Sort the array by relationshipType
if relationshipType occours for first time, save it and display it
else continue displaying other details

when relationshipType changes, it won't be equal to curr_relationship and hence will display it

UI CHANGES: replace the silver badge with

@djaiss

NOTE: test are not written in cypress yet

Sort the  array by relationshipType
if relationshipType occours for first time, save it and display it
else continue displaying other details

when relationshipType changes, it won't be equal to curr_relationship and hence will display it
@CLAassistant
Copy link

CLAassistant commented Mar 5, 2020

CLA assistant check
All committers have signed the CLA.

@ashawe ashawe changed the title Sort relationship by relationship types fix: Sort relationship by relationship types Mar 5, 2020
@ashawe ashawe force-pushed the 2395-Sort-Relationships-according-to-RelationshipType branch from 2f5c51e to 09fdf1e Compare March 5, 2020 16:58
@ashawe ashawe changed the title fix: Sort relationship by relationship types fix: [WIP]Sort relationship by relationship types Mar 5, 2020
apparently it was happening due to file being included twice
@ashawe ashawe changed the title fix: [WIP]Sort relationship by relationship types fix: Sort relationship by relationship types Mar 5, 2020
@ashawe ashawe marked this pull request as ready for review March 5, 2020 18:22
@ashawe ashawe changed the title fix: Sort relationship by relationship types fix: [WIP]Sort relationship by relationship types Mar 5, 2020
@ashawe ashawe changed the title fix: [WIP]Sort relationship by relationship types fix: Sort relationship by relationship types Mar 5, 2020
@sonarcloud
Copy link

sonarcloud bot commented Mar 5, 2020

Kudos, SonarCloud Quality Gate passed!

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities (and Security Hotspot 0 Security Hotspots to review)
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

Copy link
Member

@asbiin asbiin left a comment

Choose a reason for hiding this comment

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

As I'm OK with the idea, the php code has no place in the bade template.

@@ -1,9 +1,25 @@
@php
Copy link
Member

Choose a reason for hiding this comment

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

I really don't like using @php in Laravel.
In every case, it could be done in the Controller instead, and that's the place it has to be moved.

Copy link
Author

Choose a reason for hiding this comment

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

can you point me in the right direction and tell me in which file should I place the sort function and where does the $relationships array comes from, So I can sort them there itself and do the displaying here accordingly

Copy link
Member

Choose a reason for hiding this comment

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

The relationships array comes from resources/views/people/relationship/index.blade.php file, and the ContactsController@show method. Each @include use another list of relationships (which is not really optimized code btw...)

You can call the getLocalizedName and store it in the relationship object using a map method, and reorder the collection with sortByCollator macro.

@asbiin
Copy link
Member

asbiin commented Jan 3, 2021

closing this after long non-activity time

@asbiin asbiin closed this Jan 3, 2021
@github-actions
Copy link

github-actions bot commented Jan 4, 2022

This pull request has been automatically locked since there
has not been any recent activity after it was closed.
Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 4, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Sort Relationships
3 participants