Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -44,7 +44,7 @@ if 'access_token' not in st.session_state:
|
|
| 44 |
code=auth_code
|
| 45 |
)
|
| 46 |
st.session_state.access_token = token_response['access_token']
|
| 47 |
-
st.
|
| 48 |
except Exception as e:
|
| 49 |
st.error(f"An error occurred: {str(e)}. Please try authorizing again.")
|
| 50 |
|
|
@@ -59,11 +59,11 @@ if 'access_token' in st.session_state:
|
|
| 59 |
activities = list(client.get_activities(limit=100))
|
| 60 |
df = pd.DataFrame([{
|
| 61 |
'name': activity.name,
|
| 62 |
-
'distance': activity.distance.
|
| 63 |
-
'moving_time': activity.moving_time.total_seconds() / 3600,
|
| 64 |
-
'elevation_gain': activity.total_elevation_gain.
|
| 65 |
'type': activity.type,
|
| 66 |
-
'start_date': activity.start_date.date()
|
| 67 |
} for activity in activities])
|
| 68 |
return df
|
| 69 |
|
|
|
|
| 44 |
code=auth_code
|
| 45 |
)
|
| 46 |
st.session_state.access_token = token_response['access_token']
|
| 47 |
+
st.rerun() # Changed from experimental_rerun to rerun
|
| 48 |
except Exception as e:
|
| 49 |
st.error(f"An error occurred: {str(e)}. Please try authorizing again.")
|
| 50 |
|
|
|
|
| 59 |
activities = list(client.get_activities(limit=100))
|
| 60 |
df = pd.DataFrame([{
|
| 61 |
'name': activity.name,
|
| 62 |
+
'distance': float(activity.distance) if activity.distance is not None else 0,
|
| 63 |
+
'moving_time': activity.moving_time.total_seconds() / 3600 if activity.moving_time is not None else 0,
|
| 64 |
+
'elevation_gain': float(activity.total_elevation_gain) if activity.total_elevation_gain is not None else 0,
|
| 65 |
'type': activity.type,
|
| 66 |
+
'start_date': activity.start_date.date() if activity.start_date is not None else None
|
| 67 |
} for activity in activities])
|
| 68 |
return df
|
| 69 |
|