:*)
This commit is contained in:
16
migrations/2021-07-06_fix.py
Normal file
16
migrations/2021-07-06_fix.py
Normal file
@@ -0,0 +1,16 @@
|
||||
from copy import deepcopy
|
||||
from pathlib import Path
|
||||
from shutil import copy
|
||||
import json
|
||||
|
||||
journal_path = Path.home() / '.journal.json'
|
||||
|
||||
copy(str(journal_path), str(journal_path.with_suffix('.bkp')))
|
||||
|
||||
journal = json.loads(journal_path.read_text())
|
||||
new_journal = deepcopy(journal)
|
||||
|
||||
for day in journal['days']:
|
||||
new_journal['days'][day]['entries'] = journal['days'][day]['entries'][0]
|
||||
|
||||
journal_path.write_text(json.dumps(new_journal))
|
||||
Reference in New Issue
Block a user