Skip to content

Commit a4a6585

Browse files
committed
move check for quotes in comment
1 parent 4ac4904 commit a4a6585

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

mapswipe_workers/mapswipe_workers/utils/api_calls.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -125,11 +125,16 @@ def remove_noise_and_add_user_info(json: dict) -> dict:
125125

126126
for feature in json["features"]:
127127
changeset = changeset_results[feature["properties"]["changesetId"]]
128-
# we need to replace " as this will cause problems when importing to postgres
129-
feature["properties"]["username"] = changeset["username"].replace('"', "")
130128
feature["properties"]["userid"] = changeset["userid"]
131-
feature["properties"]["comment"] = changeset["comment"].replace('"', "")
132-
feature["properties"]["created_by"] = changeset["created_by"].replace('"', "")
129+
for attribute_name in ["username", "comment", "created_by"]:
130+
# we need to replace " as this will cause problems
131+
# when importing to postgres
132+
try:
133+
feature["properties"][attribute_name] = changeset[
134+
attribute_name
135+
].replace('"', "")
136+
except AttributeError:
137+
pass
133138

134139
logger.info("finished filtering and adding extra info")
135140
if any(x > 0 for x in missing_rows.values()):

0 commit comments

Comments
 (0)