Skip to content

Conversation

@djaiss
Copy link
Member

@djaiss djaiss commented Mar 4, 2018

This is a massive change of the codebase, including some breaking changes in the API.

This is the first step to address #19 (set relationship to a person) and #117.

The idea is

  • to merge kids and partners into a single table
  • to create a new table relationship_types which would allow any type of relationships between two persons.

The scope of this PR is not to allow custom relationships now. It is to have the equivalent of what we have now, with the new tables structure, make sure it works. It has to be transparent to the user.

The new system manages masculine/feminine of each relationship type (and localized too), like Father/mother, daughter/son, etc...

Each new relationship type belongs to a relationship type group. For instance, daughter/son type belongs to the Family relationship type group.

Here are the relationship types that we are going to introduce:

  • Partner
  • Spouse
  • Date
  • Lover
  • In love with
  • Ex
  • Parent
  • Child
  • Sibling
  • Grand parents
  • Grand children
  • Uncle
  • Nephew
  • Cousine
  • God father
  • God son
  • Friend
  • Best friend
  • Colleague
  • Boss
  • Mentor

Remaining tasks

  • Create new relationship table
  • Migrate current significant others to the new system
  • Update the add/edit/delete relationship views
  • Migrate current kids/offsprings/parents into the new Relationships table in a migration
  • Put back reminders and make them work with the new system
  • Make sure emails display the right name/gender/information about family
  • Add a new box in the Profile page of a contact to display all the relationships the contact has
  • Remove all the unused methods about Offsprings/Progenitors
  • Fix unit tests
  • Change the API
  • Change the seeders
  • Impact on account export.
  • Impact on importing data with vCard and .csv files.
  • Impact on account reset and deletion.
  • CHANGELOG entry added, if necessary, under UNRELEASED.
  • If it's relevant, add the documentation about your feature in the README file.
  • Add screenshots

@codecov
Copy link

codecov bot commented Mar 4, 2018

Codecov Report

Merging #971 into master will increase coverage by 1.1%.
The diff coverage is 49.7%.

Impacted file tree graph

@@            Coverage Diff             @@
##             master    #971     +/-   ##
==========================================
+ Coverage      36.8%   37.9%   +1.1%     
  Complexity       11      11             
==========================================
  Files           192     193      +1     
  Lines          5225    5119    -106     
==========================================
+ Hits           1919    1936     +17     
+ Misses         3306    3183    -123
Impacted Files Coverage Δ Complexity Δ
app/Http/Controllers/Api/ApiContactController.php 8.9% <ø> (+3.2%) 0 <0> (ø) ⬇️
...p/Controllers/Contacts/RelationshipsController.php 0% <0%> (-5.6%) 0 <0> (ø)
...es/RelationshipType/RelationshipTypeCollection.php 0% <0%> (ø) 0 <0> (?)
...ttp/Resources/Contact/ContactWithContactFields.php 0% <0%> (ø) 0 <0> (ø) ⬇️
app/Http/Controllers/Contacts/GiftsController.php 19.4% <0%> (-0.6%) 0 <0> (ø)
...Http/Controllers/Api/ApiRelationshipController.php 0% <0%> (ø) 0 <0> (?)
app/Http/Resources/Relationship/Relationship.php 0% <0%> (ø) 0 <0> (?)
...nshipTypeGroup/RelationshipTypeGroupCollection.php 0% <0%> (ø) 0 <0> (?)
app/Http/Resources/Contact/Contact.php 100% <100%> (ø) 0 <0> (ø) ⬇️
...es/RelationshipTypeGroup/RelationshipTypeGroup.php 100% <100%> (ø) 0 <0> (?)
... and 27 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update aa869d5...916107c. Read the comment docs.

@djaiss djaiss self-assigned this Mar 20, 2018
@asbiin asbiin temporarily deployed to monica-team-pr-971 March 20, 2018 11:09 Inactive
asbiin
asbiin previously requested changes Mar 20, 2018
'name' => 'boss',
'name_reverse_relationship' => 'boss',
'relationship_type_group_id' => $id,
]);
Copy link
Member

Choose a reason for hiding this comment

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

Should you not add a relation colleague<=>boss ?

@asbiin
Copy link
Member

asbiin commented Mar 20, 2018

This PR would close #117 too right ?

@asbiin asbiin temporarily deployed to monica-team-pr-971 March 21, 2018 17:10 Inactive
@asbiin asbiin temporarily deployed to monica-team-pr-971 March 22, 2018 00:39 Inactive
@asbiin asbiin temporarily deployed to monica-team-pr-971 March 22, 2018 00:58 Inactive
@asbiin asbiin temporarily deployed to monica-team-pr-971 March 22, 2018 02:57 Inactive
@djaiss djaiss dismissed asbiin’s stale review March 31, 2018 00:35

I've done what you asked

@asbiin asbiin temporarily deployed to monica-team-pr-971 March 31, 2018 00:40 Inactive
@asbiin asbiin temporarily deployed to monica-team-pr-971 March 31, 2018 04:00 Inactive
@asbiin asbiin temporarily deployed to monica-team-pr-971 April 1, 2018 12:38 Inactive
@asbiin asbiin temporarily deployed to monica-team-pr-971 April 1, 2018 19:13 Inactive
@asbiin asbiin temporarily deployed to monica-team-pr-971 April 1, 2018 19:16 Inactive
@asbiin asbiin temporarily deployed to monica-team-pr-971 April 1, 2018 19:28 Inactive
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.

Great job !!

app/Account.php Outdated
// create new account
$account = new self;
$account->api_key = str_random(30);
$account->created_at = Carbon::now();
Copy link
Member

Choose a reason for hiding this comment

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

you should use now() helper - see #1051

Copy link
Member Author

Choose a reason for hiding this comment

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

done

*/
public function getRelationshipTypeByType(string $relationshipTypeName)
{
return $this->relationshipTypes->where('name', $relationshipTypeName)->first();
Copy link
Member

Choose a reason for hiding this comment

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

add ->get() to return the object, and not the Query\Builder instance

Copy link
Member Author

Choose a reason for hiding this comment

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

get would return a collection, I need a single item.

Copy link
Member

Choose a reason for hiding this comment

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

ok ok

{{ csrf_field() }}
</form>
<p class="mb0">
<a href="/people/{{ $contact->id }}/relationships/new?type={{ $contact->account->getRelationshipTypeByType('child')->id }}">Add</a>
Copy link
Member

Choose a reason for hiding this comment

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

"Add" should be localized

Copy link
Member Author

Choose a reason for hiding this comment

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

Well done

@include('people.relationship._relationship', ['relationships' => $workRelationships])

<p class="mb0">
<a href="/people/{{ $contact->id }}/relationships/new?type={{ $contact->account->getRelationshipTypeByType('friend')->id }}">Add</a>
Copy link
Member

Choose a reason for hiding this comment

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

"Add" should be localized

Copy link
Member Author

Choose a reason for hiding this comment

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

Well done

@asbiin asbiin temporarily deployed to monica-team-pr-971 April 1, 2018 22:16 Inactive
@asbiin asbiin temporarily deployed to monica-team-pr-971 April 2, 2018 00:19 Inactive
@asbiin asbiin temporarily deployed to monica-team-pr-971 April 2, 2018 00:29 Inactive
@djaiss djaiss changed the title Merge kids/partners tables into a relationships table [wip] Refactor relationships Apr 2, 2018
@djaiss djaiss merged commit ae521f5 into master Apr 2, 2018
@asbiin asbiin mentioned this pull request Apr 7, 2018
@djaiss djaiss deleted the replace-relationships branch April 11, 2018 15:37
@github-actions
Copy link

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 Feb 11, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants