Skip to content

Commit bb76758

Browse files
committed
Fix workflow get
1 parent 0b69ac8 commit bb76758

File tree

2 files changed

+90
-2
lines changed

2 files changed

+90
-2
lines changed

src/superannotate/lib/core/usecases/projects.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -701,8 +701,9 @@ def execute(self):
701701
if self._fill_classes:
702702
annotation_classes = self._annotation_classes.get_all()
703703
for annotation_class in annotation_classes:
704-
annotation_class.uuid = workflow.class_id
705-
workflow_data["className"] = annotation_class.name
704+
if annotation_class.id == workflow.class_id:
705+
workflow_data["className"] = annotation_class.name
706+
break
706707
data.append(workflow_data)
707708
self._response.data = data
708709
return self._response

tests/integration/projects/test_basic_project.py

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,93 @@
99
from tests.integration.base import BaseTestCase
1010

1111

12+
class TestWorkflowGet(BaseTestCase):
13+
PROJECT_NAME = "TestWorkflowGet"
14+
PROJECT_TYPE = "Vector"
15+
PROJECT_DESCRIPTION = "DESCRIPTION"
16+
17+
def test_workflow_get(self):
18+
sa.create_annotation_class(
19+
self.PROJECT_NAME,
20+
"class1",
21+
"#FFAAFF",
22+
[
23+
{
24+
"name": "tall",
25+
"is_multiselect": 0,
26+
"attributes": [{"name": "yes"}, {"name": "no"}],
27+
},
28+
{
29+
"name": "age",
30+
"is_multiselect": 0,
31+
"attributes": [{"name": "young"}, {"name": "old"}],
32+
},
33+
],
34+
)
35+
sa.create_annotation_class(
36+
self.PROJECT_NAME,
37+
"class2",
38+
"#FFAAFF",
39+
[
40+
{
41+
"name": "tall",
42+
"is_multiselect": 0,
43+
"attributes": [{"name": "yes"}, {"name": "no"}],
44+
},
45+
{
46+
"name": "age",
47+
"is_multiselect": 0,
48+
"attributes": [{"name": "young"}, {"name": "old"}],
49+
},
50+
],
51+
)
52+
sa.set_project_workflow(
53+
self.PROJECT_NAME,
54+
[
55+
{
56+
"step": 1,
57+
"className": "class1",
58+
"tool": 3,
59+
"attribute": [
60+
{
61+
"attribute": {
62+
"name": "young",
63+
"attribute_group": {"name": "age"},
64+
}
65+
},
66+
{
67+
"attribute": {
68+
"name": "yes",
69+
"attribute_group": {"name": "tall"},
70+
}
71+
},
72+
],
73+
},
74+
{
75+
"step": 2,
76+
"className": "class2",
77+
"tool": 3,
78+
"attribute": [
79+
{
80+
"attribute": {
81+
"name": "young",
82+
"attribute_group": {"name": "age"},
83+
}
84+
},
85+
{
86+
"attribute": {
87+
"name": "yes",
88+
"attribute_group": {"name": "tall"},
89+
}
90+
},
91+
],
92+
}
93+
],
94+
)
95+
workflows = sa.get_project_workflow(self.PROJECT_NAME)
96+
self.assertEqual(workflows[0]['className'], "class1")
97+
self.assertEqual(workflows[1]['className'], "class2")
98+
1299

13100
class TestProjectCreateMetadata(BaseTestCase):
14101
PROJECT_NAME = "sample_basic_project"

0 commit comments

Comments
 (0)