From b14c8c4c7ccbded7a41c986bd7b970c38334c05e Mon Sep 17 00:00:00 2001 From: Shankari Date: Wed, 8 Jan 2025 11:04:09 -0500 Subject: [PATCH] Revert "Modified userstat where it passes in the trip_key as an input instead of hardcoding analysis/confirmed_trip" This reverts commit c77c5c549d1839dbcb56b0921126e769edfdebe6. Reverting because this broke the tests. https://github.com/e-mission/e-mission-server/pull/1006#issuecomment-2573807472 This is because the composite trips include both actual trips and untracked time. https://github.com/e-mission/e-mission-server/pull/1006#issuecomment-2574122106 We don't want to store untracked time in the user stats or show it to users, so we can't push this to a real production system, where people check the admin dashboard, just yet. The fix is simple, but will take @TeachMeTW some time to figure out. So let's revert the change for now. --- emission/analysis/result/user_stat.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/emission/analysis/result/user_stat.py b/emission/analysis/result/user_stat.py index 27d633cec..fa1d7ac95 100644 --- a/emission/analysis/result/user_stat.py +++ b/emission/analysis/result/user_stat.py @@ -61,9 +61,9 @@ def get_and_store_user_stats(user_id: str, trip_key: str) -> None: end_ts_result = ts.get_first_value_for_field(trip_key, "data.end_ts", pymongo.DESCENDING) end_ts = None if end_ts_result == -1 else end_ts_result - total_trips = ts.find_entries_count(key_list=[trip_key]) + total_trips = ts.find_entries_count(key_list=["analysis/confirmed_trip"]) labeled_trips = ts.find_entries_count( - key_list=[trip_key], + key_list=["analysis/confirmed_trip"], extra_query_list=[{'data.user_input': {'$ne': {}}}] )