Fix up README and code comment
This commit is contained in:
parent
851b14591f
commit
704f2520ae
3 changed files with 8 additions and 5 deletions
|
@ -15,6 +15,8 @@ Can also take an existing Loop Habit database (exported from the application),
|
||||||
and add the nomie exported habits and checkmarks to it.
|
and add the nomie exported habits and checkmarks to it.
|
||||||
Simply put the exported Loop database in the same directory and call it `output.db`,
|
Simply put the exported Loop database in the same directory and call it `output.db`,
|
||||||
it will not (should not™️) overwrite anything.
|
it will not (should not™️) overwrite anything.
|
||||||
|
If there are any duplicated habits however,
|
||||||
|
it will add duplications of the existing repetitions into the database.
|
||||||
|
|
||||||
Invoked like: `python run.py nomie-export.json`.
|
Invoked like: `python run.py nomie-export.json`.
|
||||||
Note, however, that -- until a packaged version is released -- you will need to have some packages in your environment.
|
Note, however, that -- until a packaged version is released -- you will need to have some packages in your environment.
|
||||||
|
|
|
@ -94,7 +94,8 @@ def add_to_database(
|
||||||
(sql_id, repetition.timestamp, repetition.value),
|
(sql_id, repetition.timestamp, repetition.value),
|
||||||
)
|
)
|
||||||
except sqlite3.IntegrityError:
|
except sqlite3.IntegrityError:
|
||||||
# TODO better error handling
|
# FIXME better error handling
|
||||||
|
# TODO think about adapting this to allow importing into existing databases
|
||||||
print(
|
print(
|
||||||
f"{sql_id}, {habit.name}: timestamp {datetime.fromtimestamp(repetition.timestamp/1000)} not unique, moving timestamp slightly."
|
f"{sql_id}, {habit.name}: timestamp {datetime.fromtimestamp(repetition.timestamp/1000)} not unique, moving timestamp slightly."
|
||||||
)
|
)
|
||||||
|
|
|
@ -37,8 +37,8 @@ def trackerlist():
|
||||||
|
|
||||||
|
|
||||||
def test_simple_habit_transform_from_tracker(trackerlist):
|
def test_simple_habit_transform_from_tracker(trackerlist):
|
||||||
sut = trackerlist[0]
|
result = habits.trackers_to_habits([trackerlist[0]])
|
||||||
assert habits.trackers_to_habits([sut]) == [
|
assert result == [
|
||||||
loopdata.Habit(
|
loopdata.Habit(
|
||||||
name="🧪 Testing",
|
name="🧪 Testing",
|
||||||
description="testtrack",
|
description="testtrack",
|
||||||
|
@ -51,8 +51,8 @@ def test_simple_habit_transform_from_tracker(trackerlist):
|
||||||
|
|
||||||
|
|
||||||
def test_range_habit_transform_from_tracker(trackerlist):
|
def test_range_habit_transform_from_tracker(trackerlist):
|
||||||
sut = trackerlist[1]
|
result = habits.trackers_to_habits([trackerlist[1]])
|
||||||
assert habits.trackers_to_habits([sut]) == [
|
assert result == [
|
||||||
loopdata.Habit(
|
loopdata.Habit(
|
||||||
name="🧪 Testing",
|
name="🧪 Testing",
|
||||||
description="testtrack",
|
description="testtrack",
|
||||||
|
|
Loading…
Reference in a new issue