@@ -439,6 +439,7 @@ def process_user(user):
439
439
user_uuid = UUID (user ['user_id' ])
440
440
profile_data = edb .get_profile_db ().find_one ({'user_id' : user_uuid })
441
441
# Fetch data for the user, cached for repeated queries
442
+ logging .info (f'keyspr: { profile_data } ' )
442
443
if not profile_data :
443
444
profile_data = {}
444
445
# Assign existing profile attributes to the user dictionary
@@ -447,25 +448,24 @@ def process_user(user):
447
448
user ['app_version' ] = profile_data .get ('client_app_version' )
448
449
user ['os_version' ] = profile_data .get ('client_os_version' )
449
450
user ['phone_lang' ] = profile_data .get ('phone_lang' )
450
-
451
451
452
452
# Assign newly stored statistics to the user dictionary
453
- user ['total_trips' ] = profile_data .get ('total_trips' , 0 )
454
- user ['labeled_trips' ] = profile_data .get ('labeled_trips' , 0 )
453
+ user ['total_trips' ] = profile_data .get ('total_trips' )
454
+ user ['labeled_trips' ] = profile_data .get ('labeled_trips' )
455
455
456
456
# Retrieve and assign pipeline range
457
457
pipeline_range = profile_data .get ('pipeline_range' , {})
458
- user ['pipeline_start_ts' ] = pipeline_range .get ('start_ts' )
459
- user ['pipeline_end_ts' ] = pipeline_range .get ('end_ts' )
458
+ start_ts = pipeline_range .get ('start_ts' )
459
+ end_ts = pipeline_range .get ('end_ts' )
460
+ if start_ts :
461
+ user ['first_trip' ] = arrow .get (start_ts ).format (time_format )
462
+ if end_ts :
463
+ user ['last_trip' ] = arrow .get (end_ts ).format (time_format )
460
464
461
465
# Retrieve and assign last API call timestamp
462
- user ['last_call' ] = profile_data .get ('last_call' )
463
-
464
- # Optional: Format the last_call timestamp for readability
465
- if user ['last_call' ]:
466
- user ['formatted_last_call' ] = arrow .get (user ['last_call' ]).format ('YYYY-MM-DD HH:mm:ss' )
467
- else :
468
- user ['formatted_last_call' ] = None
466
+ last_call_ts = profile_data .get ('last_call_ts' )
467
+ if last_call_ts :
468
+ user ['last_call' ] = arrow .get (last_call_ts ).format ('YYYY-MM-DD' )
469
469
470
470
esdsq .store_dashboard_time (
471
471
"admin/db_utils/add_user_stats/process_user" ,
0 commit comments