implemented updating timetrack table on stopping/starting timetrack
Signed-off-by: Stephan Richter <s.richter@srsoftware.de>
This commit is contained in:
@@ -19,6 +19,7 @@
|
||||
body : now()
|
||||
});
|
||||
if (resp.ok){
|
||||
timetrack.stopped = await resp.json();
|
||||
timetrack.running = null;
|
||||
timetrack.elapsed = null;
|
||||
timetrack.start = null;
|
||||
|
||||
@@ -32,6 +32,14 @@
|
||||
let selectionSum = $derived(sortedTimes.filter(time => selected[time.id]).map(time => time.duration).reduce((acc, a) => acc + a, 0));
|
||||
let users = null;
|
||||
|
||||
$effect(() => {
|
||||
if (timetrack.running) {
|
||||
show(timetrack.running);
|
||||
} else {
|
||||
show(timetrack.stopped);
|
||||
}
|
||||
});
|
||||
|
||||
async function addTime(task_id){
|
||||
const url = api(`time/track_task/${task_id}`);
|
||||
const resp = await post(url,now()); // create new time or return time with assigned tasks
|
||||
@@ -144,7 +152,6 @@
|
||||
}
|
||||
|
||||
async function multi_update(changeSet){
|
||||
console.log({ids:Object.keys(selected),patch:patch});
|
||||
changeSet.ids = Object.keys(selected).map(id => +id);
|
||||
const url = api('time');
|
||||
const res = await patch(url,changeSet);
|
||||
@@ -167,6 +174,11 @@
|
||||
loadTimes();
|
||||
}
|
||||
|
||||
function show(track){
|
||||
if (times && track) times[track.id] = track;
|
||||
}
|
||||
|
||||
|
||||
function toggleRange(range){
|
||||
let affected = sortedTimes.filter(time => time.start.startsWith(range));
|
||||
if (ranges[range]){
|
||||
@@ -214,6 +226,7 @@
|
||||
<title>Umbrella – {t('timetracking')}</title>
|
||||
</svelte:head>
|
||||
|
||||
|
||||
<h1>{t('timetracking')}</h1>
|
||||
{#if times}
|
||||
{#if selectionSum}
|
||||
|
||||
Reference in New Issue
Block a user