Skip to content

Commit 5b91812

Browse files
committed
make sure to not store information twice during project creation
1 parent 39b7440 commit 5b91812

File tree

1 file changed

+19
-2
lines changed
  • mapswipe_workers/mapswipe_workers/project_types/base

1 file changed

+19
-2
lines changed

mapswipe_workers/mapswipe_workers/project_types/base/project.py

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -502,8 +502,19 @@ def create_groups_txt_file(self, groups):
502502
"project_type_specifics": dict(),
503503
}
504504

505+
# these common attributes don't need to be written
506+
# to the project_type_specifics since they are
507+
# already stored in separate columns
508+
common_attributes = [
509+
"projectId",
510+
"groupId",
511+
"numberOfTasks",
512+
"requiredCount",
513+
"finishedCount" "progress",
514+
]
515+
505516
for key in group.keys():
506-
if key not in output_dict.keys():
517+
if key not in common_attributes:
507518
output_dict["project_type_specifics"][key] = group[key]
508519
output_dict["project_type_specifics"] = json.dumps(
509520
output_dict["project_type_specifics"]
@@ -570,8 +581,14 @@ def create_tasks_txt_file(self, groupsOfTasks):
570581
"geom": task["geometry"],
571582
"project_type_specifics": dict(),
572583
}
584+
585+
# these common attributes don't need to be written
586+
# to the project_type_specifics since they are
587+
# already stored in separate columns
588+
common_attributes = ["projectId", "groupId", "taskId", "geometry"]
589+
573590
for key in task.keys():
574-
if key not in output_dict.keys():
591+
if key not in common_attributes:
575592
output_dict["project_type_specifics"][key] = task[key]
576593
output_dict["project_type_specifics"] = json.dumps(
577594
output_dict["project_type_specifics"]

0 commit comments

Comments
 (0)