mirror of
https://github.com/Ellpeck/ObsidianSimpleTimeTracker.git
synced 2024-12-23 13:49:22 +01:00
made sub-entries optional
This commit is contained in:
parent
41d595201d
commit
6820640a4f
1 changed files with 4 additions and 4 deletions
|
@ -10,7 +10,7 @@ export interface Entry {
|
||||||
name: string;
|
name: string;
|
||||||
startTime: string;
|
startTime: string;
|
||||||
endTime: string;
|
endTime: string;
|
||||||
subEntries: Entry[];
|
subEntries?: Entry[];
|
||||||
collapsed?: boolean;
|
collapsed?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -253,13 +253,13 @@ function startSubEntry(entry: Entry, name: string): void {
|
||||||
|
|
||||||
if (!name)
|
if (!name)
|
||||||
name = `Part ${entry.subEntries.length + 1}`;
|
name = `Part ${entry.subEntries.length + 1}`;
|
||||||
entry.subEntries.push({ name: name, startTime: moment().toISOString(), endTime: null, subEntries: null });
|
entry.subEntries.push({ name: name, startTime: moment().toISOString(), endTime: null, subEntries: undefined });
|
||||||
}
|
}
|
||||||
|
|
||||||
function startNewEntry(tracker: Tracker, name: string): void {
|
function startNewEntry(tracker: Tracker, name: string): void {
|
||||||
if (!name)
|
if (!name)
|
||||||
name = `Segment ${tracker.entries.length + 1}`;
|
name = `Segment ${tracker.entries.length + 1}`;
|
||||||
let entry: Entry = { name: name, startTime: moment().toISOString(), endTime: null, subEntries: null };
|
let entry: Entry = { name: name, startTime: moment().toISOString(), endTime: null, subEntries: undefined };
|
||||||
tracker.entries.push(entry);
|
tracker.entries.push(entry);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -280,7 +280,7 @@ function removeEntry(entries: Entry[], toRemove: Entry): boolean {
|
||||||
let single = entry.subEntries[0];
|
let single = entry.subEntries[0];
|
||||||
entry.startTime = single.startTime;
|
entry.startTime = single.startTime;
|
||||||
entry.endTime = single.endTime;
|
entry.endTime = single.endTime;
|
||||||
entry.subEntries = null;
|
entry.subEntries = undefined;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue