Monica: Duplicate Contacts In Contacts/People Page

Created on 19 Aug 2018  路  10Comments  路  Source: monicahq/monica

Describe the bug
The same contacts appear multiples times in the Contacts/People page at www.myserver.com/people See the attached screenshot. It explains the problem.

Screenshots
Screenshot

Which version are you using:

  • A server I maintain yourself running version 2.6.0.

Additional context
This bug started to appear in version 2.6.0 I think. However, it could have been version 2.5.0 since I don't often visit the people page.

bug

Most helpful comment

This is happening to me also, when I view contacts, sort on last activity date, and filter on a tag. The people who are dup'ed are ones I appear to have entered activities for.

Notably it does not happen when sorting alphabetically.

All 10 comments

I don't understand how it is possible. Have you added the contacts manually? We have no other bug reports like this one.

Does this happen when you add a contact manually?

Person 1, Person 2, and Person 3 were all created manually instead of being imported. All of the instances of Person 1 link to the same contact page. The same goes for Person 2 and Person 3. All of my contacts have duplicates on the people page except for the most recent ones.

I see this on the contact list page for the official install. The contact list returns anywhere between 1 - 28 copies of the same contact. When clicked, they go to the same contact ID however. I think total contact count and tag counts are still correct.

Coincidentally, for those who I have copies of I also have corresponding activity counts for those contacts (i.e., a contact with 28 copies in the contact list has 28 activities)

This is happening to me also, when I view contacts, sort on last activity date, and filter on a tag. The people who are dup'ed are ones I appear to have entered activities for.

Notably it does not happen when sorting alphabetically.

I have just noticed this same bug. Sorting by last activity date brings up repeats but only of favourite contacts. Toggling off the favourite contact star returns the list to expected behaviour. Hopefully that's a helpful clue.

This might be fixed now.

@asbiin This isn't fixed for me. :/

Although @jatls has a great point, this only seems to happen on the "Sort by last activity date" sort methods. Combined with my point above about the number of copies of a person matching the number of activities for them, this is possibly a dedupe issue in the sort?

Okay so I'm not familiar with laravel, so I apologize in advance if I misunderstood but just pointing it out in case it's helpful:

Would this section of code here not result in this bug? If I understand correctly it's doing a left join between the contacts table and the activity_contact table. I'm guessing activity_contact is a mapping between activities and contacts, so it would have multiple entries for a given contact. Left joins can increase the number of rows in the left table if there are multiple matches in the right table. This is then sorted and all of the contact IDs are extracted, which I believe should lead to duplicate entries contact IDs in the result based on however many matches exist in the activity_contact table.

Fix could maybe be to dedupe using a GROUP BY that takes the latest date.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

badry-abderrahmane picture badry-abderrahmane  路  3Comments

TheGP picture TheGP  路  3Comments

baisong picture baisong  路  3Comments

djaiss picture djaiss  路  3Comments

jbiswas picture jbiswas  路  3Comments