Skip to content

Commit 9895c9b

Browse files
committed
fix db upsert bug in new_month
1 parent 344ba6b commit 9895c9b

File tree

5 files changed

+7
-4
lines changed

5 files changed

+7
-4
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[project]
22
name = "fob"
33
# Remember to update the version number in 'utils/utils.py' manually also.
4-
version = "0.2.2"
4+
version = "0.2.3"
55
description = "Focus Blocks: Simple and elegant daily time management tool."
66
readme = "README.md"
77
authors = [{ name = "tensorturtle", email = "[email protected]" }]

src/fob/commands/new_month.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def write_new_month(data: MonthBlockData, db: TinyDBWrapper) -> None:
3131

3232
# Overwrite the existing month data (shouldn't happen but avoids duplicates)
3333
q = Query()
34-
db.update({
34+
db.upsert({
3535
"year": data.year,
3636
"month": data.month,
3737
"work_days_allocated": data.work_days_allocated,

src/fob/db/wrapper.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ def insert(self, data):
1414
# Insert a document (dictionary) into the database
1515
return self.db.insert(data)
1616

17+
def upsert(self, fields, query):
18+
return self.db.upsert(fields, query)
19+
1720
def all(self):
1821
# Get all documents stored in the database
1922
return self.db.all()

src/fob/utils/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from rich import print
88

99
def get_version_number() -> tuple[int, int, int]:
10-
return (0,2,2)
10+
return (0,2,3)
1111

1212
def get_db_path(args: Namespace) -> Path:
1313
'''

uv.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)