Skip to content
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

Tagging sometimes throws an error #839

Open
mialondon opened this issue Oct 8, 2018 · 4 comments
Open

Tagging sometimes throws an error #839

mialondon opened this issue Oct 8, 2018 · 4 comments
Labels
Milestone

Comments

@mialondon
Copy link
Member

@mialondon mialondon commented Oct 8, 2018

As described in https://community.libcrowds.com/d/44-your-requests-for-help-questions-about-the-project/11

Attached should be the error message. To reproduce:

  • type 'elephant' into the tag field
  • scroll down to one of the entries for elephant that appear in the drop-down tag list and press Enter
  • the tag field now shows two elephant tags (highlighted in green)
  • delete the first of the two tags (if you delete the second tag the error does not appear, but a duplicate tag is still created)

Possibly related to #829

@mialondon mialondon added this to the 2020 fixes milestone Jan 10, 2020
@mialondon
Copy link
Member Author

@mialondon mialondon commented Jan 27, 2020

If you tag an image, the tag is apparently submitted but then you get a 'Forbidden' 'Request failed with status code 403' error message when you try to submit the task.

e.g. on https://www.libcrowds.com/collection/playbills/projects/178/iiif-annotation

@mialondon
Copy link
Member Author

@mialondon mialondon commented Feb 26, 2020

Definition of success: the tagging function pulls up existing tags quickly so that people add existing tags to images rather than creating a separate new version of the same tag.

geoffroy-noel-ddh added a commit that referenced this issue Mar 19, 2020
… added twice in the input box: once automatically by the multiselect widget when the user selects it (it contained the id of an existing annotation in the Explicates DB), and the second one was a new annotation (with same tag nane) for the current image. This should also solve various related issues where the user could delete tags assigned to other image by clicking the first tag or the error message when the first tag has already been deleted. Possibly solved the issues with the save action on the image.
geoffroy-noel-ddh added a commit that referenced this issue Mar 23, 2020
@geoffroy-noel-ddh
Copy link
Collaborator

@geoffroy-noel-ddh geoffroy-noel-ddh commented Mar 23, 2020

I've pushed a 2020-fixes branch that contains a fix for this bug.

Issues:
In the auto-complete we had two issues with duplicated tags:

  1. the tags were duplicated in the suggestion drop down when the user was searching for some words like 'elephant', 'ramo', Shakespeare'
  2. the tags were duplicated in the tagging text box when the user was selecting suggestions (e.g. click on 'elephant' in the drop down => two 'elephant' appear to be selected)
  3. it is possible for the user to remove tags applied by other users to other images
  4. removing the first tag can throw an error

Causes
The duplication issues were not caused by the performance problem.

  1. was caused by the by the auto-complete fetching annotations from Explicates Search API endpoint. An annotation is one or more tags applied to a specific image. So if the same tag was applied to multiple images it would appear multiple times in the drop down;
  2. The Libcrowds custom code creates a new Annotation record and adds its tag to the list of selected tag. That's correct behaviour and it corresponds to the second selected 'elephant'. However the auto-complete widget first selects the item the user has clicked one. That is an existing annotation already applied to another image (see cause 1) above). That explains the first 'elephant', it should never have been selected because it doesn't belong to the current image.
  3. That explains why, when the user clicks the first tag they are actually removing a pre-existing annotation that belongs to another image! This, in turn, might explain why there are many annotations marked as deleted in the database.
  4. As a side effect of 3), it was possible to select an already deleted tag (as the auto-complete widget caches the suggestions). If the user tries to remove it, an error will be thrown because it is already marked as deleted in the Explicates database.

Fixes

  • Issues 2), 3), 4) were fixed by making sure the tag the user clicks in the dropdown is never selected, only a new annotation is created for the current image on click
  • Issue 1) was fixed by creating a new Explicates API endpoint: /tags/ and making the auto-complete use that instead of /search/ endpoint. /search/ returns annotations, /tags/ returns unique tags

Deployment

  • Please checkout the 2020-fixes branch of both Explicates and Libcrowds code base. For Explicates, see the KDL fork.
  • Please test thoroughly and tell us if resolution is accepted before deploying live.
  • Highly recommended to create a backup of the Explicates database before you deploy.

Other fixed bugs

  • when user doesn't type anything in the box, the dropdown was showing the last fetched results, including tags which were already removed => the drop-down now remains empty when the user doesn't type anything;
  • it used to be possible to create a empty tag, just by pressing the space bar in the input box, an error message will now appear instead;
This was referenced Mar 23, 2020
@geoffroy-noel-ddh
Copy link
Collaborator

@geoffroy-noel-ddh geoffroy-noel-ddh commented Mar 23, 2020

@mialondon @harjmos Please see resolution comment, let me know if you have any question/problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants