Adding entities to a document does not persist properly #2769
Labels
No labels
backend
critical
defect
duplicate
enhancement
fixed
frontend
general
invalid
major
minor
normal
oxjs
pandora_client
python-ox
task
trivial
wontfix
worksforme
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
0x2620/pandora#2769
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Steps to reproduce:
a) Data → Manage Documents…
b) Select a document
c) Start typing a participant, accept the autocomplete suggestion
d) Click Done
e) Re-open Data → Manage Documents…, and reselect the document
f) Be very disappointed that the tag has vanished
The
editDocumentrequest is sent with thisdata:It's not immediately obvious (to me) from
static/js/documentsPanel.jswhere theundefinedis coming from.The
undefinedis because noidis provided here: http://code.0x2620.org/pandora/annotate/4965/static/js/documentsPanel.js#L678But it is a red herring. The actual issue is that this call to
findEntitieshttp://code.0x2620.org/pandora/annotate/4965/static/js/documentsPanel.js#L769 returns nothing. If I make the same query with{key: 'name', value: entity.name, operator: '='}(ie contains), it returns the entity.I think this is caused by pandora revision 4918 mapping queries against
nametoname_find: http://code.0x2620.org/pandora/annotate/4965/pandora/entity/managers.py#L8 . Ifoperator == '=='then the resulting query will bename_find__iexact="Foo"– which is guaranteed to fail, since the entity hasname == "Foo"but `name_find == "|Foo|I guess the intention was to make
findEntitiestreat a query againstnameas matching any ofalternativeNamestoo, which works fine for substring matches. I think the only thing for it is to share the|%s|%s|%s|etc logic fromautocompleteEntities.Attachment 0001-Entity-fix-name_find-when-alternativeNames-is-non-em.patch (1109 bytes) added
Entity: fix name_find when alternativeNames is non-empty
Attachment 0002-Fix-findEntities-.-name-x.patch (2463 bytes) added
Fix findEntities( ... name == x ... )
With these patches it's possible to associate entities with a document. The form can get a bit confused because item.entities is not updated (cf the
fixmes indocumentsPanel.js) but this is a start.(I think it's a bit surprising that you can't edit the entities for a document using
editDocumentbut that's another story.)Attachment 0003-Fix-references-to-findDocument-s-in-docstrings.patch (2578 bytes) added
Fix references to findDocument[]s in docstrings
In []changeset:pandora,4981: