Skip to content
Snippets Groups Projects
Commit 09210adc authored by Romin's avatar Romin :eye:
Browse files

Handle new responsible_organiation field in create_project (rearranges parameters)

parent f98a21fa
Branches handlebars-maks
No related tags found
No related merge requests found
......@@ -669,9 +669,10 @@ class ApiClient:
start_date: date,
end_date: date,
principal_investigators: str,
disciplines: list[Discipline],
organizations: list[Organization],
visibility: Visibility,
disciplines: list[Discipline],
responsible_organization: Organization,
additional_organizations: list[Organization] | None = None,
keywords: list[str] | None = None,
grant_id: str = "",
parent_id: str = ""
......@@ -693,12 +694,15 @@ class ApiClient:
Date when the project ends.
principal_investigators
The project PIs.
disciplines
List of associated scientific disciplines.
organizations
List of organizations partaking in the project.
visibility
Project metadata visibility (relevant for search).
disciplines
List of associated scientific disciplines.
responsible_organization
The lead organization.
additional_organizations
List of organizations partaking in the project. The responsible
organization may not re-appear here.
keywords
List of project keywords (relevant for search).
grant_id
......@@ -706,12 +710,14 @@ class ApiClient:
parent_id
Parent project ID if the project should be a subproject.
"""
org_data = [
organization.serialize()
for organization in organizations
]
for item in org_data:
item["responsible"] = True
# Responsible organization and additional organizations are given
# as a single list, with the differentiating aspect of an additional
# responsible = True field for the responsible organization.
organizations = []
organizations.append(responsible_organization.serialize())
organizations[0]["responsible"] = True
for org in additional_organizations:
organizations.append(org.serialize())
data: dict = {
"name": name,
"displayName": display_name,
......@@ -723,7 +729,7 @@ class ApiClient:
discipline.serialize()
for discipline in disciplines
],
"organizations": org_data,
"organizations": organizations,
"visibility": visibility.serialize(),
"keywords": keywords if keywords else [],
"grantId": grant_id
......
......@@ -714,9 +714,10 @@ class Project:
start_date: date,
end_date: date,
principal_investigators: str,
disciplines: list[Discipline],
organizations: list[Organization],
visibility: Visibility,
disciplines: list[Discipline],
responsible_organization: Organization,
additional_organizations: list[Organization] | None = None,
keywords: list[str] | None = None,
grant_id: str = ""
) -> Project:
......@@ -737,12 +738,15 @@ class Project:
Date when the project ends.
principal_investigators
The project PIs.
disciplines
List of associated scientific disciplines.
organizations
List of organizations partaking in the project.
visibility
Project metadata visibility (relevant for search).
disciplines
List of associated scientific disciplines.
responsible_organization
The lead organization.
additional_organizations
List of organizations partaking in the project. The responsible
organization may not re-appear here.
keywords
List of project keywords (relevant for search).
grant_id
......@@ -757,9 +761,10 @@ class Project:
start_date,
end_date,
principal_investigators,
disciplines,
organizations,
visibility,
disciplines,
responsible_organization,
additional_organizations,
keywords,
grant_id,
self.id
......
......@@ -137,10 +137,9 @@ project = client.create_project(
datetime.now().date(),
datetime.now().date(),
"Test User",
client.visibility("Project Members"),
[client.discipline("Computer Science 409")],
[client.organization("https://ror.org/04xfq0f34")],
# -> RWTH Aachen University
client.visibility("Project Members")
client.organization("https://ror.org/04xfq0f34"), # -> RWTH Aachen
)
###############################################################################
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment