some saveTracker improvements

This commit is contained in:
Ell 2022-09-29 16:05:39 +02:00
parent 826f57ad76
commit ed9c7767ef
3 changed files with 8 additions and 4 deletions

View file

@ -30,7 +30,9 @@ export function isRunning(tracker: Tracker): boolean {
export async function saveTracker(tracker: Tracker, app: App, section: MarkdownSectionInformation): Promise<void> { export async function saveTracker(tracker: Tracker, app: App, section: MarkdownSectionInformation): Promise<void> {
let file = app.workspace.getActiveFile(); let file = app.workspace.getActiveFile();
let content = await app.vault.cachedRead(file); if (!file)
return;
let content = await app.vault.read(file);
// figure out what part of the content we have to edit // figure out what part of the content we have to edit
let lines = content.split("\n"); let lines = content.split("\n");

File diff suppressed because one or more lines are too long

View file

@ -2,7 +2,7 @@
These are the notes for my cool project. There's so much left to do! I wish I had a way to track the amount of time I spend on each part of the project. These are the notes for my cool project. There's so much left to do! I wish I had a way to track the amount of time I spend on each part of the project.
```simple-time-tracker ```simple-time-tracker
{"entries":[{"name":"Think about project","startTime":1664305777,"endTime":1664308788},{"name":"Create project note","startTime":1664308810,"endTime":1664308815},{"name":"Work on project","startTime":1664308830,"endTime":1664309301},{"name":"Segment 4","startTime":1664364444,"endTime":1664364449},{"name":"Segment 5","startTime":1664364495,"endTime":1664364498},{"name":"Segment 6","startTime":1664458520,"endTime":1664458523}]} {"entries":[{"name":"Think about project","startTime":1664305777,"endTime":1664308788},{"name":"Create project note","startTime":1664308810,"endTime":1664308815},{"name":"Work on project","startTime":1664308830,"endTime":1664309301},{"name":"Segment 4","startTime":1664364444,"endTime":1664364449},{"name":"Segment 5","startTime":1664364495,"endTime":1664364498},{"name":"Segment 6","startTime":1664458520,"endTime":1664458523},{"name":"Segment 7","startTime":1664460326,"endTime":1664460329}]}
``` ```
``` ```