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

Remove null (gap) to prevent validation errors #728

Merged
merged 8 commits into from
Jan 19, 2024
Merged

Conversation

lehecht
Copy link
Contributor

@lehecht lehecht commented Dec 22, 2023

If single frame and clip annotations are linked and are not touching each other, then null is added. When deleting the single frame annotation, delete also the null.

Fix #488

If single and clip annotations are linked
and are not touching each other, then null is added.
When deleting the single frame annotation, delete also the null.

Fix #488
@mzur
Copy link
Member

mzur commented Jan 2, 2024

There is still an error if I put the single-frame annotation before the multi-frame annotation.

Check for null at array beginning and delete remaining gap filler
@lehecht
Copy link
Contributor Author

lehecht commented Jan 3, 2024

I found a related bug.
If you delete an annotation within a multiframe annotation, which is bordered by single frame annotations on each side, you will get the error message Invalid number of points for shape Point!. It occurs for all shapes, with whom you can create a multiframe annotation.

mzur
mzur previously approved these changes Jan 4, 2024
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.

This works, thanks!

@mzur
Copy link
Member

mzur commented Jan 4, 2024

If you delete an annotation within a multiframe annotation, which is bordered by single frame annotations on each side, you will get the error message Invalid number of points for shape Point!.

Could you please also fix this in this PR?

app/Traits/HasPointsAttribute.php Outdated Show resolved Hide resolved
resources/assets/js/videos/models/Annotation.vue Outdated Show resolved Hide resolved
@lehecht
Copy link
Contributor Author

lehecht commented Jan 15, 2024

@mzur you can check it out now.

@mzur
Copy link
Member

mzur commented Jan 15, 2024

I have pushed the implementation of my idea and I still think it works. Can you please test it, too?

@lehecht
Copy link
Contributor Author

lehecht commented Jan 17, 2024

@mzur it works. And now I understood what you meant. I was really confused before. Thanks!

@mzur
Copy link
Member

mzur commented Jan 17, 2024

Sorry, I'll try to be more clear next time 😉 Do we still need the other change? If yes, please move it to the VideoAnnotation model.

@lehecht lehecht requested a review from mzur January 18, 2024 07:46
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.

Thanks! I'm sorry to drag this on even more but could you now please add a test for the new validation behavior? The test should be written in a way that would fail before the change and pass with the change.

@lehecht
Copy link
Contributor Author

lehecht commented Jan 19, 2024

The test should be written in a way that would fail before the change and pass with the change.

What do you mean by that? The change is implemented within the model, so it is always tested if the array is empty or not.

@mzur
Copy link
Member

mzur commented Jan 19, 2024

I would like to have a test like this one that checks the new behavior of validating an annotation with a gap. If the test would be executed before the changes of this PR, it should fail. After the changes of this PR, the test should pass.

@lehecht
Copy link
Contributor Author

lehecht commented Jan 19, 2024

For me it sounds like, you want something like this. That is why I'm still confused, because the whole test will always fail.

$this->model->shape_id = Shape::pointId();
$this->model->points = [[]];
$this->model->validatePoints(); // does not fail
$this->expectException(Exception::class);
$this->model->points = [[]];
$this->model->validatePoints(); // should fail, but does not

@mzur
Copy link
Member

mzur commented Jan 19, 2024

I meant something like this: 16d1f2a

Before your change, this would fail, although it is perfectly valid. We could even extend the validation so it checks that there are no consecutive empty arrays or there is a mismatch between the empty array position and the null but I think we don't have to overengineer this now.

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.

All good now 👍

@mzur mzur merged commit 63df78a into master Jan 19, 2024
6 checks passed
@mzur mzur deleted the annotation-deletion-bug branch January 19, 2024 09:48
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.

Bug when deleting single-frame/multi-frame annotation with gap
2 participants