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

Fixed issue: is not a constructor when create object, save, undo, save, redo save #3292

Merged
merged 4 commits into from
Jun 5, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -30,6 +30,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Project page requests took a long time and did many DB queries (<https://github.com/openvinotoolkit/cvat/pull/3223>)
- Fixed Python 3.6 support (<https://github.com/openvinotoolkit/cvat/pull/3258>)
- Incorrect attribute import in tracks (<https://github.com/openvinotoolkit/cvat/pull/3229>)
- Issue "is not a constructor" when create object, save, undo, save, redo save (<https://github.com/openvinotoolkit/cvat/pull/3292>)
- Fix CLI create an infinite loop if git repository responds with failure (<https://github.com/openvinotoolkit/cvat/pull/3267>)

### Security
2 changes: 1 addition & 1 deletion cvat-core/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion cvat-core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cvat-core",
"version": "3.13.1",
"version": "3.13.2",
"description": "Part of Computer Vision Tool which presents an interface for client-side integration",
"main": "babel.config.js",
"scripts": {
1 change: 1 addition & 0 deletions cvat-core/src/annotations-collection.js
Original file line number Diff line number Diff line change
@@ -788,6 +788,7 @@
() => {
importedArray.forEach((object) => {
object.removed = false;
object.serverID = undefined;
});
},
importedArray.map((object) => object.clientID),
4 changes: 2 additions & 2 deletions cvat-core/src/annotations-saver.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// Copyright (C) 2019-2020 Intel Corporation
// Copyright (C) 2019-2021 Intel Corporation
//
// SPDX-License-Identifier: MIT

(() => {
const serverProxy = require('./server-proxy');
const { Task } = require('./session');
const { ScriptingError } = './exceptions';
const { ScriptingError } = require('./exceptions');

class AnnotationsSaver {
constructor(version, collection, session) {
21 changes: 21 additions & 0 deletions cvat-core/tests/api/annotations.js
Original file line number Diff line number Diff line change
@@ -311,6 +311,27 @@ describe('Feature: check unsaved changes', () => {
});

describe('Feature: save annotations', () => {
test('create, save, undo, save, redo save', async () => {
const task = (await window.cvat.tasks.get({ id: 101 }))[0];
await task.annotations.get(0);
const state = new window.cvat.classes.ObjectState({
frame: 0,
objectType: window.cvat.enums.ObjectType.SHAPE,
shapeType: window.cvat.enums.ObjectShape.POLYGON,
points: [0, 0, 100, 0, 100, 50],
occluded: true,
label: task.labels[0],
zOrder: 0,
});

await task.annotations.put([state]);
await task.annotations.save();
await task.actions.undo();
await task.annotations.save();
await task.actions.redo();
await task.annotations.save();
});

test('create & save annotations for a task', async () => {
const task = (await window.cvat.tasks.get({ id: 101 }))[0];
let annotations = await task.annotations.get(0);