Merge Participants

The merging function combines duplicate Person records in the registration system due to duplicate registrations.

Merging needs to merge the relevant properties of the duplicate Person records, but also update foreign keys to the duplicate records to point to the new master Person record. This might include Participant and Result details.

Selecting a merge target

The merge target is the Person record which will become the new, single instance for the person.

The latest login record is considered the merge target, unless non are login records, in which case the latest non-login record is used.

The rational is that the latest record would typically contain the most up-to-date information.

Merging Person

The properties of the latest Person record will trump other conflicting properties. Properties not found in the latest, but in older records, will be copied over.

Merging Managed By

Owned records

All ManagedBy properties need to be moved to the new, target record, de-duplicating them if necessary.

Self references

ManagedBy properties need to be added any old login enabled records, as the person could still use them. So, the target record gets a ManagedBy record pointing to each of the old Person login record(s).

Other references

MangedBy properties on other Person records, not for the person being merged, pointing to the non-target Person, need to point to each of the login records of the merged person. This ensures that the merged person, no matter which login they use, can still manage the configured persons.

Other Persons: Pointing to login non-targets - Keep Add pointer(s) to all login records of Merged Person

Old person records

Old, non-login records can be flagged as deleted. They will never be used again. They cannot be deleted, as they are required to indicate the deleted status for syncing purposes.

Login records will need to remain active, although all merged participant information can be removed.

Remove participant info

Remove participant details from non-target and non-login records

Move

Move managed by from non-target, non-login records to the target record.

Syncing

The target records will differ in hash codes, resulting in a sync update.

Old records will be flagged as deleted, or will have its participant information removed, which no longer makes them Participant candidates and should therefore be removed from all syned Person stores.