systopia / de.systopia.mutualaid

Fight Corona by organising mutual aid in your neighbourhood with this CiviCRM Extension!
Other
8 stars 3 forks source link

Matching failed: Duplicate Relationship #18

Open bjendres opened 4 years ago

bjendres commented 4 years ago

@nicol reports:

"CiviCRM_API3_Exception: "Matching failed: Duplicate Relationship".

If the only new records are coming through the forms then this probably isn't an issue as there's no way to create both a request and an offer together in the same record (only via import or adminastrator config). But am guessing longer term there may be scenarios where the same person is both offering and requesting things.

bjendres commented 4 years ago

I think this exception would probably occur, if there is multiple active relationships for one offer-request pair. The scenario I could think of would be:

  1. helpee A requests one type of help
  2. request gets matched to helper B
  3. the relationship gets confirmed
  4. helpee A adds a new help type to his/her request
  5. the new request also gets matched to helper B
  6. the current algorithm would now try to create a second (active) helper relationship between the two, and I think CiviCRM doesn't allow that.

@nicol: Does that sound plausible to you?

vingle commented 4 years ago

Hey - sorry didn't see this as @vingle here.

Yeh that sounds like it. It also crossed my mind that someone might receive help and a month later they are recoverred and immune and offering help - so the relationship would get created in the other direction. Sounds like an edge-case, tho is there any way the matching issues report could pick it up?

bjendres commented 4 years ago

The other way around shouldn't be an issue.

bjendres commented 4 years ago

I have put some code into place so this edge case doesn't crash the matcher any more, and released it with 1.1-beta2

bjendres commented 4 years ago

A proper fix for this would be, to amend an already existing relationship (for a different help type), but then the question is whether this needs confirmation again, and how to communicate the change.... We won't look into this until somebody really needs it.