nkhajouei commited on
Commit
83000e7
·
verified ·
1 Parent(s): 38994c9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -5
app.py CHANGED
@@ -4,6 +4,7 @@ import streamlit as st
4
  import sqlite3
5
  import hashlib
6
  import uuid
 
7
  from datetime import datetime
8
 
9
  # --- 1. DATABASE SETUP & HELPERS ---
@@ -70,7 +71,6 @@ def save_workout(user, workout_key):
70
 
71
  for exercise in workout['exercises']:
72
  for set_num in range(1, exercise['sets'] + 1):
73
- # Check if the set was marked as completed
74
  completed_key = f"completed_{workout_key}_{exercise['name']}_{set_num}"
75
  if st.session_state.get(completed_key, False):
76
  weight = 0
@@ -88,7 +88,6 @@ def save_workout(user, workout_key):
88
  st.balloons()
89
 
90
  def get_history_df(user_id):
91
- # This function remains the same, it will correctly read the saved data
92
  with sqlite3.connect("fitforge.db") as conn:
93
  query = """
94
  SELECT
@@ -176,13 +175,12 @@ else:
176
  show_exercise_details(ex['name'])
177
 
178
  for j in range(1, ex['sets'] + 1):
179
- cols = st.columns([1, 3, 3, 2])
 
180
  cols[0].markdown(f"**Set {j}**")
181
- # Show weight/reps for "weight" type, otherwise just the checkbox
182
  if ex['type'] == 'weight':
183
  cols[1].number_input("Weight (lbs)", min_value=0, step=5, value=25, key=f"weight_{workout_key}_{ex['name']}_{j}")
184
  cols[2].number_input("Reps", min_value=0, step=1, value=12, key=f"reps_{workout_key}_{ex['name']}_{j}")
185
- # The checkbox is always the last item in the row
186
  cols[3].checkbox("Done", key=f"completed_{workout_key}_{ex['name']}_{j}")
187
 
188
  with st.expander("Cool-down (3 mins)"):
 
4
  import sqlite3
5
  import hashlib
6
  import uuid
7
+ import pandas as pd # FIXED: Added missing import for Pandas
8
  from datetime import datetime
9
 
10
  # --- 1. DATABASE SETUP & HELPERS ---
 
71
 
72
  for exercise in workout['exercises']:
73
  for set_num in range(1, exercise['sets'] + 1):
 
74
  completed_key = f"completed_{workout_key}_{exercise['name']}_{set_num}"
75
  if st.session_state.get(completed_key, False):
76
  weight = 0
 
88
  st.balloons()
89
 
90
  def get_history_df(user_id):
 
91
  with sqlite3.connect("fitforge.db") as conn:
92
  query = """
93
  SELECT
 
175
  show_exercise_details(ex['name'])
176
 
177
  for j in range(1, ex['sets'] + 1):
178
+ # UPDATED: Changed column ratios to make inputs narrower
179
+ cols = st.columns([1.5, 2, 2, 1])
180
  cols[0].markdown(f"**Set {j}**")
 
181
  if ex['type'] == 'weight':
182
  cols[1].number_input("Weight (lbs)", min_value=0, step=5, value=25, key=f"weight_{workout_key}_{ex['name']}_{j}")
183
  cols[2].number_input("Reps", min_value=0, step=1, value=12, key=f"reps_{workout_key}_{ex['name']}_{j}")
 
184
  cols[3].checkbox("Done", key=f"completed_{workout_key}_{ex['name']}_{j}")
185
 
186
  with st.expander("Cool-down (3 mins)"):