aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Vanbesien <tvanbesi@proton.me>2026-03-18 16:36:14 +0100
committerThomas Vanbesien <tvanbesi@proton.me>2026-03-18 16:36:14 +0100
commitcd12c8e26b6713bf174076dc288b610f890a0588 (patch)
tree9033ca3f6625bd89a3afea8c7e0efcccba5d36d7
parent3a867e3b0c966f84d607fc0ceafb2fdee893ed5d (diff)
downloadEgoMetrics-cd12c8e26b6713bf174076dc288b610f890a0588.tar.gz
EgoMetrics-cd12c8e26b6713bf174076dc288b610f890a0588.zip
Remove note field from weight logging
-rw-r--r--db.py3
-rw-r--r--models.py7
-rw-r--r--screens/weight.py6
3 files changed, 6 insertions, 10 deletions
diff --git a/db.py b/db.py
index a7be976..390bb5d 100644
--- a/db.py
+++ b/db.py
@@ -63,8 +63,7 @@ CREATE INDEX IF NOT EXISTS idx_workout_template_exercises_template
CREATE TABLE IF NOT EXISTS weight_logs (
id INTEGER PRIMARY KEY AUTOINCREMENT,
date_time TEXT NOT NULL,
- weight REAL NOT NULL,
- note TEXT
+ weight REAL NOT NULL
);
CREATE INDEX IF NOT EXISTS idx_weight_logs_date
diff --git a/models.py b/models.py
index 6def19e..d67e4c0 100644
--- a/models.py
+++ b/models.py
@@ -261,11 +261,10 @@ def add_weight_log(
conn: sqlite3.Connection,
date_time: str,
weight: float,
- note: str | None = None,
) -> int:
cur = conn.execute(
- "INSERT INTO weight_logs (date_time, weight, note) VALUES (?, ?, ?)",
- (date_time, weight, note),
+ "INSERT INTO weight_logs (date_time, weight) VALUES (?, ?)",
+ (date_time, weight),
)
conn.commit()
assert cur.lastrowid is not None
@@ -274,7 +273,7 @@ def add_weight_log(
def list_weight_logs(conn: sqlite3.Connection, limit: int = 20) -> list[sqlite3.Row]:
return conn.execute(
- "SELECT id, date_time, weight, note FROM weight_logs ORDER BY date_time DESC LIMIT ?",
+ "SELECT id, date_time, weight FROM weight_logs ORDER BY date_time DESC LIMIT ?",
(limit,),
).fetchall()
diff --git a/screens/weight.py b/screens/weight.py
index 5669f07..f5bb216 100644
--- a/screens/weight.py
+++ b/screens/weight.py
@@ -10,8 +10,7 @@ def log_weight(conn: sqlite3.Connection) -> None:
date_time = ui.prompt_datetime("Date/Time")
weight = ui.prompt_float("Weight (kg): ", min_val=0.1)
assert weight is not None
- note = ui.prompt_str("Note (optional): ", required=False)
- models.add_weight_log(conn, date_time, weight, note)
+ models.add_weight_log(conn, date_time, weight)
print(f"Logged {weight:.1f}kg.")
ui.pause()
@@ -49,11 +48,10 @@ def view_weight_logs(conn: sqlite3.Connection) -> None:
log["date_time"],
f"{weight:.1f}",
diff,
- log["note"] or "",
]
)
- ui.print_table(["#", "Date", "Weight (kg)", "Diff", "Note"], rows)
+ ui.print_table(["#", "Date", "Weight (kg)", "Diff"], rows)
choice = input("\nSelect # to delete ('b' = back): ").strip()
if choice.lower() == "b":