-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
API gloss update "non-updated fields" #1368
Comments
DISCUSSION @Woseseltops read here I made a separate issue for this, since it's not a bug, but a usage concern.
|
So the situation is that gloss = get_object_or_404(Gloss, glossid=glossid) And then for each field in the incoming JSON check if it's different before we do anything with it? |
Yes, that is what is being done. I suppose it could be made more like a tuple (the minimal pairs computation makes use of a tuple for comparison), but... The problem is that the "field choices" are in human readable form. But the gloss has object foreign keys. So the lookup to compare data is also looking up to find out whether a human readable value is the same as the field choice of the foreign key. Moreover, the API supports multiple languages to be used in the human readable form. (The language code is given in the header.) So roughly, to process the API:
The operation needs to fail if (i) fails. In additional to field choices, the user can also update annotations, senses, and lemma's if the lemma is not shared by other glosses. These fields refer to other objects, as well as video and image files. These updates can also fail. Because the update involves many steps that all need to be done in a transaction, any can fail and the database can also become locked. The intention of the API was that the user only provides fields that actually need to be updated. It becomes tricky because "empty" input can represent deletion as well as ignore. |
@Woseseltops you can see the extent of the above if in the Admin you look at Gloss Revisions I can modify it so the "empty" ones are not stored, but the comparison operations are being performed on all the empty fields that are not changed. |
We noticed that you send all the fields in the request to update the gloss. However this gives a lot of non-informative changes in the revision history (see https://signbank.cls.ru.nl/dictionary/gloss/49249/history)
We clearly did not document this well ;)
However the intention for this api was to only include the fields that are changed so it only updates those and leaves the others as is and they are not added to the revision history. Just so you know! You can close this issue again when read.
Originally posted by @Jetske in #1360 (comment)
The text was updated successfully, but these errors were encountered: