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
49549cff
Commit
49549cff
authored
6 months ago
by
Tim Repke
Browse files
Options
Downloads
Patches
Plain Diff
fix things
parent
f63b930c
No related branches found
No related tags found
1 merge request
!106
Main
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
server/api/routes/annotations.py
+1
-1
1 addition, 1 deletion
server/api/routes/annotations.py
server/api/routes/highlight.py
+9
-8
9 additions, 8 deletions
server/api/routes/highlight.py
with
10 additions
and
9 deletions
server/api/routes/annotations.py
+
1
−
1
View file @
49549cff
...
...
@@ -302,7 +302,7 @@ async def get_assignment_indicators_for_scope(assignment_scope_id: str,
permissions
=
Depends
(
UserPermissionChecker
(
'
annotations_read
'
)))
\
->
list
[
AssignmentScopeEntry
]:
return
await
read_assignment_overview_for_scope
(
assignment_scope_id
=
assignment_scope_id
,
db_engine
=
db_engine
)
connection
=
db_engine
)
@router.get
(
'
/annotate/assignments/scope/{assignment_scope_id}
'
,
response_model
=
list
[
AssignmentModel
])
...
...
This diff is collapsed.
Click to expand it.
server/api/routes/highlight.py
+
9
−
8
View file @
49549cff
...
...
@@ -5,12 +5,11 @@ from sqlalchemy import select
from
sqlalchemy
import
func
as
F
from
server.data
import
db_engine
from
server.api.errors
import
\
NoDataForKeyError
,
\
DataNotFoundWarning
from
server.util.security
import
\
UserPermissionChecker
,
\
from
server.api.errors
import
NoDataForKeyError
from
server.util.security
import
(
UserPermissionChecker
,
InsufficientPermissions
)
from
nacsos_data.util.auth
import
UserPermissions
from
nacsos_data.db.schemas.annotations
import
AssignmentScope
...
...
@@ -26,7 +25,7 @@ router = APIRouter()
@router.get
(
'
/scope/{assignment_scope_id}
'
,
response_model
=
list
[
HighlighterModel
]
|
None
)
async
def
get_scope_highlighters
(
assignment_scope_id
:
str
,
permissions
:
UserPermissions
=
Depends
(
UserPermissionChecker
(
'
annotations_read
'
)))
\
->
list
[
HighlighterModel
]:
->
list
[
HighlighterModel
]
|
None
:
async
with
db_engine
.
session
()
as
session
:
# type: AsyncSession
highlighter_ids
=
select
(
F
.
unnest
(
AssignmentScope
.
highlighter_ids
).
label
(
'
highlighter_id
'
))
\
.
where
(
AssignmentScope
.
assignment_scope_id
==
assignment_scope_id
)
\
...
...
@@ -38,8 +37,10 @@ async def get_scope_highlighters(assignment_scope_id: str,
result
=
(
await
session
.
scalars
(
stmt
)).
all
()
if
result
is
not
None
and
len
(
result
)
>
0
:
return
[
HighlighterModel
.
model_validate
(
r
.
__dict__
)
for
r
in
result
]
raise
DataNotFoundWarning
(
f
'
No highlighter in project
{
permissions
.
permissions
.
project_id
}
'
f
'
for scope with id
{
assignment_scope_id
}
!
'
)
return
None
# raise DataNotFoundWarning(f'No highlighter in project {permissions.permissions.project_id} '
# f'for scope with id {assignment_scope_id}!')
@router.get
(
'
/project
'
,
response_model
=
list
[
HighlighterModel
])
...
...
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