Skip to content

Commit

Permalink
Merge pull request #1074 from vantage6/feature/studies
Browse files Browse the repository at this point in the history
Added comments to clarify whether study or collaboration id should be…
  • Loading branch information
bartvanb committed Mar 7, 2024
2 parents 5eeecd0 + 24b4094 commit d3639c6
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
Expand Up @@ -21,9 +21,19 @@
},
"collaboration_id": {
"type": "integer",
"description": "Collaboration id",
"description": (
"Collaboration id. You do not need to provide this if you "
"provide a study id (but you can if you want to)."
),
},
"study_id": {
"type": "integer",
"description": (
"Study id. You should only provide this if you want to "
"create a task for a specific study. Otherwise, you should "
"provide just a collaboration id."
),
},
"study_id": {"type": "integer", "description": "Study id"},
"organizations": {
"type": "dict",
"description": (
Expand Down
5 changes: 5 additions & 0 deletions vantage6-server/vantage6/server/resource/task.py
Expand Up @@ -560,6 +560,11 @@ def post_task(data: dict, socketio: SocketIO, rules: RuleCollection):
"errors": errors,
}, HTTPStatus.BAD_REQUEST

# A task can be created for a collaboration or a study. If it is for a study,
# a study_id is always given, and a collaboration_id is optional. If it is for
# a collaboration, a collaboration_id is always given, and a study_id is
# never set. The following logic checks if the given study_id and
# collaboration_id are valid and when both are provided, checks if they match.
collaboration_id = data.get("collaboration_id")
study_id = data.get("study_id")
study = None
Expand Down

0 comments on commit d3639c6

Please sign in to comment.