Skip to content

Commit

Permalink
Fixed issue: is not a constructor when create object, save, undo, sav…
Browse files Browse the repository at this point in the history
…e, redo save (#3292)

* Fixed issue #3216

* Updated version & changelog

* Added unit test

Co-authored-by: Nikita Manovich <nikita.manovich@intel.com>
  • Loading branch information
Boris Sekachev and Nikita Manovich authored Jun 5, 2021
1 parent 59e47a3 commit 284be86
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
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": {
Expand Down
1 change: 1 addition & 0 deletions cvat-core/src/annotations-collection.js
Original file line number Diff line number Diff line change
Expand Up @@ -788,6 +788,7 @@
() => {
importedArray.forEach((object) => {
object.removed = false;
object.serverID = undefined;
});
},
importedArray.map((object) => object.clientID),
Expand Down
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) {
Expand Down
21 changes: 21 additions & 0 deletions cvat-core/tests/api/annotations.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 284be86

Please sign in to comment.