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

Fix bug with unchanged label color after swap #625

Merged
merged 6 commits into from
Aug 7, 2023
Merged

Conversation

lehecht
Copy link
Contributor

@lehecht lehecht commented Jul 12, 2023

Annotations were not updated because the annotation watcher was not triggered by the color change. Add a refreshAnnotation method which replaces the old annotation by the new one in the annotationSource.

@lehecht
Copy link
Contributor Author

lehecht commented Jul 12, 2023

I was a little too quick with this PR. I forgot to check the video annotations. When I'm finished, I will let you know.

@mzur
Copy link
Member

mzur commented Jul 12, 2023

There are also too many commits in this PR. Maybe you have to update your branches?

@lehecht
Copy link
Contributor Author

lehecht commented Jul 12, 2023

Maybe you have to update your branches?

What do you mean by this? I merged the current master into this branch. Isn't this branch updated now?
Or should I create a new branch and transfer my changes from this branch to the new (updated) one?

@mzur
Copy link
Member

mzur commented Jul 12, 2023

I see 67 commits in this PR but only one implements the code changes. Somehow all newer commits from master are shown, too. You can fix this by starting a new branch from master and cherry-picking the single commit. I think you can even reuse this PR with a force push:

# Start fresh from master.
git checkout master
# Create a new branch with a different name.
git checkout -b lsb
# Cherry-pick the commit to the new branch.
git cherry-pick 28e448a
# Delete the old branch.
git branch -D label-swap-bug
# Rename the new branch to the old name.
git branch -m label-swap-bug
# Force push to update this PR.
git push -fu origin label-swap-bug

Annotations were not updated because the annotation watcher
was not triggered by the color change. Add a refreshAnnotation method
which replaces the old annotation by the new one in the annotationSource.
Label color wasn't updated because 'refresh' event wasn't triggered.
Add refreshAnnotation method and emit event to call it after successfully
detaching annotation.
@lehecht
Copy link
Contributor Author

lehecht commented Jul 13, 2023

You can review my changes now.

@lehecht
Copy link
Contributor Author

lehecht commented Jul 13, 2023

# Start fresh from master.
git checkout master
# Create a new branch with a different name.
git checkout -b lsb
# Cherry-pick the commit to the new branch.
git cherry-pick 28e448a

Should I do it like this every time a branch is outdated?

@mzur
Copy link
Member

mzur commented Jul 13, 2023

You can review my changes now.

In the future, you can also click on "request review" at the top right of a PR to let me know I should have a look. That should be easier for you.

Should I do it like this every time a branch is outdated?

No, it was only a problem because you seem to have created the branch from an outdated master, then updated the master and merged the changes into the branch. Only then you have added the commit that actually implemented the changes in the branch. Usually you only merge the other way around (from the branch to master) when the PR is merged. So most of the time, if you don't merge anything into your branch, it should be fine.

@mzur mzur linked an issue Jul 13, 2023 that may be closed by this pull request
Copy link
Member

@mzur mzur left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It does what it should but I would structure it a bit differently. This way we can fix the same issue when a label is deleted, too.

resources/assets/js/annotations/annotatorContainer.vue Outdated Show resolved Hide resolved
resources/assets/js/videos/videoContainer.vue Outdated Show resolved Hide resolved
resources/assets/js/videos/videoContainer.vue Outdated Show resolved Hide resolved
Copy link
Member

@mzur mzur left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks! Two lines are no longer needed. I will remove them myself.

@mzur mzur merged commit 6300a86 into master Aug 7, 2023
5 checks passed
@mzur mzur deleted the label-swap-bug branch August 7, 2023 13:46
@dlangenk
Copy link
Member

dlangenk commented Aug 9, 2023

@mzur Is this already live? Because the color does not change and the old labels are not "really" deleted, i.e. they still appear in the annotations list in the sidebar. However, if you click the delete button (the little x) sometimes an error occurs: No query results for model [Biigle\ImageAnnotationLabel] 15900345. Don't know if this is important. The annotations I want to swap were created by Lukas

@mzur
Copy link
Member

mzur commented Aug 9, 2023

The label swapping only works for your own labels. If the annotation has a label of a different user, your label is attached and the other label is kept, too. If you want to replace labels of other users you can use Largo (with the "force" button pressed) or you have to detach the other label with the "x".

I don't know why you get the error. Can you provide steps to reproduce it?

@dlangenk
Copy link
Member

dlangenk commented Aug 9, 2023

Shouldn't this follow the same logic as Largo, with experts and admins etc.?

Not sure about reproducing it but the best bet is:

  1. Label swap a lot of labels from another user
  2. Manually click on the little 'x' (quite quickly) of the "old" labels.
  3. error

@mzur
Copy link
Member

mzur commented Aug 10, 2023

Shouldn't this follow the same logic as Largo, with experts and admins etc.?

It does. Largo has the "force" button that needs to be active so experts/admins can delete or replace labels of other users. The label swap tool doesn't have this button. We could add another button next to the label swap button (with the same icon but with a red background) that experts/admins can use to swap labels of other users. What do you think?

Not sure about reproducing it but the best bet is: [...]

This would make sense. If the requests to swap the labels are still pending, you still see the labels in the sidebar. When you try to delete them, the backend eventually catches up and the old labels no longer exist, producing the error.

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

Successfully merging this pull request may close these issues.

Label swap does not update label color
3 participants