Skip to content

Commit bd71dce

Browse files
committed
fix failing test for user stats and add username attribute
1 parent 644c97e commit bd71dce

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

mapswipe_workers/mapswipe_workers/generate_stats/user_stats.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def get_agg_results_by_user_id(
3737
] - (raw_contributions_df["agreeing_contributions"] + 1)
3838

3939
agg_results_by_user_id_df = raw_contributions_df.groupby(
40-
["project_id", "user_id"]
40+
["project_id", "user_id", "username"]
4141
).agg(
4242
groups_completed=pd.NamedAgg(column="group_id", aggfunc=pd.Series.nunique),
4343
total_contributions=pd.NamedAgg(column="user_id", aggfunc="count"),

mapswipe_workers/tests/integration/test_get_results_real_project.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ def setUp(self):
2424
"mapping_sessions",
2525
"mapping_sessions_results",
2626
]:
27-
print(data_type)
2827
set_up.set_postgres_test_data(project_type, data_type, fixture_name)
2928

3029
self.results_filename = os.path.join(

mapswipe_workers/tests/unittests/test_user_stats.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ def test_get_agg_results_by_user_id(self):
3333
)
3434
agg_results_by_user_id_df.sort_index(inplace=True)
3535

36+
print(agg_results_by_user_id_df)
37+
38+
print(self.user_stats_df)
39+
3640
assert_frame_equal(
3741
agg_results_by_user_id_df, self.user_stats_df, check_dtype=False
3842
)

0 commit comments

Comments
 (0)