specify / specify7

Specify 7
https://www.specifysoftware.org/products/specify-7/
GNU General Public License v2.0
62 stars 36 forks source link

`agent-merging`: Add to the audit log #2907

Open grantfitzsimmons opened 1 year ago

maxpatiiuk commented 1 year ago

Can someone test a few things related to this? When merging 2 agents, what does audit log look like for them (remember, one record is deleted, another edited) What does the audit log for the tables that used the old agent look like (i.e, Collector, Determiner, Accession Agent, Loan Agent)?

Based on what we see, we should consider adding a new type of entry to the audit log - a record merge action (in addition to the tree merge we already have in there)

chanulee1 commented 1 year ago

After merging 2 agents, changes to the remaining agent's fields are displayed as updates in the audit log. Not sure if it's a bug, but changes to the GUID field don't seem to appear in the audit log.

To-be-merged agents:

image

Merged record: https://coldfish-agent-merging.test.specifysystems.org/specify/view/agent/73/

Audit log of remaining agent after merge (last three rows are from a previous merge):

image

Audit log of determinations (no determiner records in this database) associated with merged agent is empty and are now associated with the agentid of the first agent:

image

Likewise with accession agent record:

image

And with collector records (Applies to collector records associated with either of the records before merging):

image

Merging agents with addresses:

image

image

Merged record: https://coldfish-agent-merging.test.specifysystems.org/specify/view/agent/20735/

Audit log (does not seem to register updates to address; also tried merging the addresses themselves as well):

image

Anything you would like to see or want me to clarify?

maxpatiiuk commented 1 year ago

Looks like back end does not allow front-end to update GUIDs, which is why it is not in the audit log:

https://github.com/specify/specify7/blob/7b9bc5c28b2c596f929affbe1fc0fd2d52572690/specifyweb/specify/api.py#L357

@grantfitzsimmons should we add a way for front-end to update guid so that people can merge it? or should we just hide it from the agent merging screen?

Agent GUIDs are not crucial at the moment, but GUIDs for other tables can be more important (i.e, Collection Object once merging tool can support them)

maxpatiiuk commented 1 year ago

@acwhite211 can you add a new audit log action type that denotes a record merge and create an entry with that type when doing the merge?

grantfitzsimmons commented 1 year ago

@grantfitzsimmons should we add a way for front-end to update guid so that people can merge it? or should we just hide it from the agent merging screen?

At the moment I have never heard of someone using the GUID field for Agents, but in the future merging localities, taxon records, etc. it will be essential to support updating GUIDs on the front-end as you said. We can hide GUID for this release and expand it in the future?

maxpatiiuk commented 1 year ago

@acwhite211 can you please look into fixing this before initial agent merging release?

It should be a simple feature to add. And it would allow showing a stat on the stats page of how many records were merged (by running a count query on the audit log)