Skip to content
Snippets Groups Projects
Commit 5f57ac6e authored by Schiffer, Christian's avatar Schiffer, Christian
Browse files

Make sure project and task ids do not get assigned multiple times

parent bb0cab5d
No related branches found
No related tags found
No related merge requests found
......@@ -174,8 +174,8 @@ class Database(object):
key_value_dict=key_value_dict,
operation="set")
def get_project_by_id(self, project_id):
"""
def get_project_by_id(self, project_id):
"""
Get a project with a given id.
Args:
......@@ -184,7 +184,6 @@ class Database(object):
Returns:
atlas_server.models.Project
"""
project = self.projects.find_one({"project_id": project_id})
if not project:
raise ProjectNotFoundError(project_id=project_id)
......@@ -269,7 +268,7 @@ class Database(object):
new_task_id = max(task.task_id for task in project.tasks) + 1
project_ids.insert_one({"project_id": project_id, "next_task_id": new_task_id})
else:
new_task_id = project_ids.next_task_id
new_task_id = project_ids["next_task_id"]
task.task_id = new_task_id
# Add created and modified info to task
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment