Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
N
NACSOS Core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
MCC APSIS
NACSOS
NACSOS Core
Commits
cdebe87e
Commit
cdebe87e
authored
1 year ago
by
Tim Repke
Browse files
Options
Downloads
Patches
Plain Diff
fix random_nql
parent
920baf4d
No related branches found
No related tags found
1 merge request
!85
Master
Pipeline
#2921
passed
1 year ago
Stage: build
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
server/api/routes/annotations.py
+15
-1
15 additions, 1 deletion
server/api/routes/annotations.py
with
15 additions
and
1 deletion
server/api/routes/annotations.py
+
15
−
1
View file @
cdebe87e
...
@@ -9,7 +9,8 @@ from nacsos_data.db.schemas import (
...
@@ -9,7 +9,8 @@ from nacsos_data.db.schemas import (
BotAnnotationMetaData
,
BotAnnotationMetaData
,
AssignmentScope
,
AssignmentScope
,
User
,
User
,
Annotation
,
BotAnnotation
Annotation
,
BotAnnotation
)
)
from
nacsos_data.models.annotations
import
(
from
nacsos_data.models.annotations
import
(
AnnotationSchemeModel
,
AnnotationSchemeModel
,
...
@@ -72,6 +73,7 @@ from nacsos_data.util.annotations.validation import (
...
@@ -72,6 +73,7 @@ from nacsos_data.util.annotations.validation import (
)
)
from
nacsos_data.util.annotations.assignments.random
import
random_assignments
from
nacsos_data.util.annotations.assignments.random
import
random_assignments
from
nacsos_data.util.annotations.assignments.random_exclusion
import
random_assignments_with_exclusion
from
nacsos_data.util.annotations.assignments.random_exclusion
import
random_assignments_with_exclusion
from
nacsos_data.util.annotations.assignments.random_nql
import
random_assignments_with_nql
from
server.api.errors
import
(
from
server.api.errors
import
(
SaveFailedError
,
SaveFailedError
,
...
@@ -388,6 +390,18 @@ async def make_assignments(payload: MakeAssignmentsRequestModel,
...
@@ -388,6 +390,18 @@ async def make_assignments(payload: MakeAssignmentsRequestModel,
except
ValueError
as
e
:
except
ValueError
as
e
:
raise
HTTPException
(
status_code
=
http_status
.
HTTP_400_BAD_REQUEST
,
raise
HTTPException
(
status_code
=
http_status
.
HTTP_400_BAD_REQUEST
,
detail
=
str
(
e
))
detail
=
str
(
e
))
elif
payload
.
config
.
config_type
==
'
random_nql
'
:
try
:
assignments
=
await
random_assignments_with_nql
(
assignment_scope_id
=
payload
.
scope_id
,
annotation_scheme_id
=
payload
.
annotation_scheme_id
,
project_id
=
permissions
.
permissions
.
project_id
,
config
=
payload
.
config
,
# type: ignore[arg-type] # FIXME
engine
=
db_engine
)
except
ValueError
as
e
:
raise
HTTPException
(
status_code
=
http_status
.
HTTP_400_BAD_REQUEST
,
detail
=
str
(
e
))
else
:
else
:
raise
HTTPException
(
status_code
=
http_status
.
HTTP_501_NOT_IMPLEMENTED
,
raise
HTTPException
(
status_code
=
http_status
.
HTTP_501_NOT_IMPLEMENTED
,
detail
=
f
'
Method
"
{
payload
.
config
.
config_type
}
"
is unknown.
'
)
detail
=
f
'
Method
"
{
payload
.
config
.
config_type
}
"
is unknown.
'
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment