Skip to content

Commit 9b43810

Browse files
authored
Merge pull request #606 from mapswipe/dev
Dev - fix missing username for users with osm account
2 parents ec03a0b + 67ce673 commit 9b43810

File tree

10 files changed

+285870
-6
lines changed

10 files changed

+285870
-6
lines changed

mapswipe_workers/mapswipe_workers/generate_stats/project_stats.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,14 @@ def get_results(filename: str, project_id: str) -> pd.DataFrame:
112112
ms.start_time,
113113
ms.end_time,
114114
msr.result,
115-
U.username
115+
-- the username for users which login to MapSwipe with their
116+
-- OSM account is not defined or ''.
117+
-- We capture this here as it will cause problems
118+
-- for the user stats generation.
119+
CASE
120+
WHEN U.username IS NULL or U.username = '' THEN 'unknown'
121+
ELSE U.username
122+
END as username
116123
FROM mapping_sessions_results msr
117124
LEFT JOIN mapping_sessions ms ON
118125
ms.mapping_session_id = msr.mapping_session_id
@@ -185,6 +192,14 @@ def get_tasks(filename: str, project_id: str) -> pd.DataFrame:
185192
write_sql_to_gzipped_csv(filename, sql_query)
186193

187194
df = load_df_from_csv(filename)
195+
196+
# Tasks for the "footprint" project type can contain a "username" attribute.
197+
# We rename this attribute into "osm_username" to be able to distinguish it
198+
# later from the username of the MapSwipe user.
199+
# The optional OSM username in the tasks of the "footprint" project type refers
200+
# to the OSM user who has last edited the OSM object.
201+
if "username" in df.columns:
202+
df.rename(columns={"username": "osm_username"}, inplace=True)
188203
return df
189204

190205

mapswipe_workers/tests/integration/fixtures/footprint/groups/osm_validation_malawi.csv

Lines changed: 1823 additions & 0 deletions
Large diffs are not rendered by default.

mapswipe_workers/tests/integration/fixtures/footprint/mapping_sessions/osm_validation_malawi.csv

Lines changed: 5687 additions & 0 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)