From f7292e9c4c3703ed67bacb2379934c585f680558 Mon Sep 17 00:00:00 2001 From: Giuliano Crucioli Date: Sat, 6 Dec 2025 16:34:30 +0100 Subject: [PATCH 1/3] Delate bug, add today study time in the statistics --- study_time.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/study_time.py b/study_time.py index a10d23b..0e99e15 100644 --- a/study_time.py +++ b/study_time.py @@ -139,7 +139,6 @@ def show_statistics(): # Total minutes per subject print("\nTotal minutes per subject:") df_subj = df.groupby("Subject")["Seconds"].sum() - print(type(df_subj[0])) print(df_subj.apply(format_time)) # Daily totals @@ -156,7 +155,13 @@ def show_statistics(): # Overall total total_all = df["Seconds"].sum() print(f"\nOverall study time: {format_time(total_all)}\n") + + today = pd.Timestamp.today().normalize() + + # Filter for rows matching today and sum the seconds + today_seconds = df[df["Date"] == today]["Seconds"].sum() + print(f"Study time today: {format_time(today_seconds)}") def show_plots(): """ From 4cf2ad1984ad2e9941c19a46ee3bfc92bd8c006a Mon Sep 17 00:00:00 2001 From: Giuliano Crucioli Date: Sat, 6 Dec 2025 16:43:59 +0100 Subject: [PATCH 2/3] Add stability To make it more stable now the file .csv is always saved in the same folder of where the script .py is located wherever you run the code. --- study_time.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/study_time.py b/study_time.py index 0e99e15..16c9ff6 100644 --- a/study_time.py +++ b/study_time.py @@ -4,9 +4,16 @@ import matplotlib.pyplot as plt import pandas as pd -# importing the cvs in which to record study sessions +# importing the cvs in which to record study sessions. +# The file is always saved in the same folder where +# the file study_time.py is located, wherever the +# script is runned. + +# get path of where this file is located +script_dir = os.path.dirname(os.path.abspath(__file__)) +data_file = os.path.join(script_dir, "StudyTime.csv") + # subjects = list of subjects to study -data_file = "StudyTime.csv" if os.path.exists(data_file): df = pd.read_csv(data_file) subjects = df["Subject"].fillna("NaN").unique().tolist() @@ -154,7 +161,7 @@ def show_statistics(): # Overall total total_all = df["Seconds"].sum() - print(f"\nOverall study time: {format_time(total_all)}\n") + print(f"\nOverall study time: {format_time(total_all)}") today = pd.Timestamp.today().normalize() From e6db30e7e8fc6e1e660ff3d448cadd120cdb1b83 Mon Sep 17 00:00:00 2001 From: Giuliano Crucioli Date: Sat, 13 Dec 2025 23:29:40 +0100 Subject: [PATCH 3/3] Update .gitignore --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index 8d046d7..a919d97 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,3 @@ StudyTime.csv +SudyTime_test.csv +test.py