shamimjony1000 commited on
Commit
0d6906f
·
verified ·
1 Parent(s): 401e8b9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +24 -0
app.py CHANGED
@@ -25,6 +25,7 @@ def main():
25
 
26
  # Display the tasks in a table format with Task ID
27
 
 
28
  if st.session_state.tasks:
29
  st.write("Today's Tasks:")
30
  df = pd.DataFrame(st.session_state.tasks)
@@ -32,6 +33,29 @@ def main():
32
  df['Task Duration (minutes)'] = df['Task Duration (minutes)'].astype(int)
33
  st.table(df[['Task ID', 'Task Name', 'Task Time', 'Task Duration (hours)', 'Task Duration (minutes)', 'Category']]) # Include Task ID here
34
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
35
 
36
 
37
  # Input field for deleting a task by ID
 
25
 
26
  # Display the tasks in a table format with Task ID
27
 
28
+ '''
29
  if st.session_state.tasks:
30
  st.write("Today's Tasks:")
31
  df = pd.DataFrame(st.session_state.tasks)
 
33
  df['Task Duration (minutes)'] = df['Task Duration (minutes)'].astype(int)
34
  st.table(df[['Task ID', 'Task Name', 'Task Time', 'Task Duration (hours)', 'Task Duration (minutes)', 'Category']]) # Include Task ID here
35
 
36
+ '''
37
+ if st.session_state.tasks:
38
+ st.write("Today's Tasks:")
39
+
40
+ # Convert session tasks to DataFrame
41
+ df = pd.DataFrame(st.session_state.tasks)
42
+
43
+ # Ensure that 'Task Time' is in datetime format
44
+ df['Task Time'] = pd.to_datetime(df['Task Time'])
45
+
46
+ # Filter tasks for today only
47
+ today = pd.Timestamp.today().date()
48
+ today_tasks = df[df['Task Time'].dt.date == today]
49
+
50
+ if not today_tasks.empty:
51
+ today_tasks['Task Duration (hours)'] = today_tasks['Task Duration (hours)'].astype(int)
52
+ today_tasks['Task Duration (minutes)'] = today_tasks['Task Duration (minutes)'].astype(int)
53
+
54
+ # Show today's tasks in a table
55
+ st.table(today_tasks[['Task ID', 'Task Name', 'Task Time', 'Task Duration (hours)', 'Task Duration (minutes)', 'Category']])
56
+ else:
57
+ st.write("No tasks for today.")
58
+
59
 
60
 
61
  # Input field for deleting a task by ID