From 3c62e638a0ae91e36d9af601a9662ba276cef934 Mon Sep 17 00:00:00 2001 From: kshitijrajsharma Date: Mon, 22 Jan 2024 17:25:44 +0545 Subject: [PATCH 1/3] Fixes bug for old osm data --- backend/core/utils.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/backend/core/utils.py b/backend/core/utils.py index 3181eec7..3c09b559 100644 --- a/backend/core/utils.py +++ b/backend/core/utils.py @@ -192,6 +192,7 @@ def process_feature(feature, aoi_id, foreign_key_id, feedback=False): tags = properties["tags"] geometry = feature["geometry"] if feedback: + FeedbackLabel.objects.filter(aoi__id=aoi_id).delete() if FeedbackLabel.objects.filter( osm_id=int(osm_id), feedback_aoi__training=foreign_key_id ).exists(): @@ -209,6 +210,7 @@ def process_feature(feature, aoi_id, foreign_key_id, feedback=False): ) else: + Label.objects.filter(aoi__id=aoi_id).delete() if Label.objects.filter( osm_id=int(osm_id), aoi__dataset=foreign_key_id ).exists(): From 5351d4a3ff2480c5ee3fb0a94c0039417781fbf0 Mon Sep 17 00:00:00 2001 From: kshitijrajsharma Date: Mon, 22 Jan 2024 17:39:53 +0545 Subject: [PATCH 2/3] Fix bug of removing layer inside thread --- backend/core/utils.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/backend/core/utils.py b/backend/core/utils.py index 3c09b559..82a403a8 100644 --- a/backend/core/utils.py +++ b/backend/core/utils.py @@ -192,7 +192,6 @@ def process_feature(feature, aoi_id, foreign_key_id, feedback=False): tags = properties["tags"] geometry = feature["geometry"] if feedback: - FeedbackLabel.objects.filter(aoi__id=aoi_id).delete() if FeedbackLabel.objects.filter( osm_id=int(osm_id), feedback_aoi__training=foreign_key_id ).exists(): @@ -210,7 +209,6 @@ def process_feature(feature, aoi_id, foreign_key_id, feedback=False): ) else: - Label.objects.filter(aoi__id=aoi_id).delete() if Label.objects.filter( osm_id=int(osm_id), aoi__dataset=foreign_key_id ).exists(): @@ -247,7 +245,10 @@ def process_geojson(geojson_file_path, aoi_id, feedback=False): max_workers = ( (os.cpu_count() - 1) if os.cpu_count() != 1 else 1 ) # leave one cpu free always - + if feedback: + FeedbackLabel.objects.filter(aoi__id=aoi_id).delete() + else : + Label.objects.filter(aoi__id=aoi_id).delete() # max_workers = os.cpu_count() # get total cpu count available on the with open(geojson_file_path) as f: From 04010c26c537f735343989ddeab465dc48126c0c Mon Sep 17 00:00:00 2001 From: kshitijrajsharma Date: Mon, 22 Jan 2024 18:42:22 +0545 Subject: [PATCH 3/3] fix for the feedback aoi id --- backend/core/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/core/utils.py b/backend/core/utils.py index 82a403a8..fe8c5619 100644 --- a/backend/core/utils.py +++ b/backend/core/utils.py @@ -246,7 +246,7 @@ def process_geojson(geojson_file_path, aoi_id, feedback=False): (os.cpu_count() - 1) if os.cpu_count() != 1 else 1 ) # leave one cpu free always if feedback: - FeedbackLabel.objects.filter(aoi__id=aoi_id).delete() + FeedbackLabel.objects.filter(feedback_aoi__id=aoi_id).delete() else : Label.objects.filter(aoi__id=aoi_id).delete() # max_workers = os.cpu_count() # get total cpu count available on the