Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -5,9 +5,6 @@ from task_operations import TaskManager
|
|
5 |
from task_visualization import TaskVisualizer
|
6 |
import pandas as pd
|
7 |
from datetime import datetime
|
8 |
-
import os
|
9 |
-
|
10 |
-
|
11 |
|
12 |
def main():
|
13 |
st.title("Daily Task Tracker")
|
@@ -19,7 +16,7 @@ def main():
|
|
19 |
if 'tasks' not in st.session_state:
|
20 |
st.session_state.tasks = task_manager.load_tasks()
|
21 |
|
22 |
-
# Task input fields
|
23 |
task_name = st.text_input("Task Name")
|
24 |
task_time = st.time_input("Task Time")
|
25 |
task_duration_hours = st.number_input("Task Duration (Hours)", min_value=0, step=1, format="%d")
|
@@ -36,13 +33,12 @@ def main():
|
|
36 |
|
37 |
# Convert session tasks to DataFrame and filter tasks for today
|
38 |
df = pd.DataFrame(st.session_state.tasks)
|
39 |
-
df['Task Time'] = pd.to_datetime(df['Task Time'])
|
40 |
-
today_tasks = df[df['Task Time'].dt.date == datetime.today().date()]
|
41 |
|
42 |
if not today_tasks.empty:
|
43 |
-
today_tasks['Task
|
44 |
-
|
45 |
-
st.table(today_tasks[['Task ID', 'Task Name', 'Task Time', 'Task Duration (hours)', 'Task Duration (minutes)', 'Category']])
|
46 |
else:
|
47 |
st.write("No tasks for today.")
|
48 |
|
@@ -54,14 +50,13 @@ def main():
|
|
54 |
else:
|
55 |
st.error(f"Task with ID '{task_id_to_delete}' not found.")
|
56 |
|
57 |
-
|
58 |
-
|
59 |
-
# Report options and other visualizations are unchanged
|
60 |
if st.button("Daily Report"):
|
61 |
report = task_manager.generate_report('daily')
|
62 |
if not report.empty:
|
63 |
st.write("Daily Report:")
|
64 |
st.dataframe(report)
|
|
|
65 |
else:
|
66 |
st.warning("No tasks for today.")
|
67 |
|
@@ -70,6 +65,7 @@ def main():
|
|
70 |
if not report.empty:
|
71 |
st.write("Weekly Report:")
|
72 |
st.dataframe(report)
|
|
|
73 |
else:
|
74 |
st.warning("No tasks for this week.")
|
75 |
|
@@ -78,6 +74,7 @@ def main():
|
|
78 |
if not report.empty:
|
79 |
st.write("Monthly Report:")
|
80 |
st.dataframe(report)
|
|
|
81 |
else:
|
82 |
st.warning("No tasks for this month.")
|
83 |
|
@@ -86,6 +83,7 @@ def main():
|
|
86 |
if not report.empty:
|
87 |
st.write("Yearly Report:")
|
88 |
st.dataframe(report)
|
|
|
89 |
else:
|
90 |
st.warning("No tasks for this year.")
|
91 |
|
|
|
5 |
from task_visualization import TaskVisualizer
|
6 |
import pandas as pd
|
7 |
from datetime import datetime
|
|
|
|
|
|
|
8 |
|
9 |
def main():
|
10 |
st.title("Daily Task Tracker")
|
|
|
16 |
if 'tasks' not in st.session_state:
|
17 |
st.session_state.tasks = task_manager.load_tasks()
|
18 |
|
19 |
+
# Task input fields
|
20 |
task_name = st.text_input("Task Name")
|
21 |
task_time = st.time_input("Task Time")
|
22 |
task_duration_hours = st.number_input("Task Duration (Hours)", min_value=0, step=1, format="%d")
|
|
|
33 |
|
34 |
# Convert session tasks to DataFrame and filter tasks for today
|
35 |
df = pd.DataFrame(st.session_state.tasks)
|
36 |
+
df['Task Time'] = pd.to_datetime(df['Task Time'])
|
37 |
+
today_tasks = df[df['Task Time'].dt.date == datetime.today().date()]
|
38 |
|
39 |
if not today_tasks.empty:
|
40 |
+
st.table(today_tasks[['Task ID', 'Task Name', 'Task Time', 'Task Duration (hours)',
|
41 |
+
'Task Duration (minutes)', 'Category']])
|
|
|
42 |
else:
|
43 |
st.write("No tasks for today.")
|
44 |
|
|
|
50 |
else:
|
51 |
st.error(f"Task with ID '{task_id_to_delete}' not found.")
|
52 |
|
53 |
+
# Report options and other visualizations remain unchanged
|
|
|
|
|
54 |
if st.button("Daily Report"):
|
55 |
report = task_manager.generate_report('daily')
|
56 |
if not report.empty:
|
57 |
st.write("Daily Report:")
|
58 |
st.dataframe(report)
|
59 |
+
visualizer.plot_category_performance('daily', task_manager)
|
60 |
else:
|
61 |
st.warning("No tasks for today.")
|
62 |
|
|
|
65 |
if not report.empty:
|
66 |
st.write("Weekly Report:")
|
67 |
st.dataframe(report)
|
68 |
+
visualizer.plot_category_performance('weekly', task_manager)
|
69 |
else:
|
70 |
st.warning("No tasks for this week.")
|
71 |
|
|
|
74 |
if not report.empty:
|
75 |
st.write("Monthly Report:")
|
76 |
st.dataframe(report)
|
77 |
+
visualizer.plot_category_performance('monthly', task_manager)
|
78 |
else:
|
79 |
st.warning("No tasks for this month.")
|
80 |
|
|
|
83 |
if not report.empty:
|
84 |
st.write("Yearly Report:")
|
85 |
st.dataframe(report)
|
86 |
+
visualizer.plot_category_performance('yearly', task_manager)
|
87 |
else:
|
88 |
st.warning("No tasks for this year.")
|
89 |
|