diff --git a/__pycache__/app.py.cpython-313.pyc b/__pycache__/app.py.cpython-313.pyc index a570823..5372173 100644 Binary files a/__pycache__/app.py.cpython-313.pyc and b/__pycache__/app.py.cpython-313.pyc differ diff --git a/app.py.final b/app.py.final index 181c668..13689de 100644 --- a/app.py.final +++ b/app.py.final @@ -52,10 +52,13 @@ class TasksProxy: def __setitem__(self, key, value): with _task_lock: tasks = _load_tasks() - tasks[key] = value + if isinstance(value, dict): + tasks[key] = value + else: + tasks[key] = value _save_tasks(tasks) def __getitem__(self, key): - return _load_tasks()[key] + return _TaskDict(key) def __contains__(self, key): return key in _load_tasks() def pop(self, key, *args): @@ -65,6 +68,21 @@ class TasksProxy: _save_tasks(tasks) return result +class _TaskDict(dict): + """Auto-saving dict wrapper for a single task.""" + def __init__(self, task_id): + self._task_id = task_id + tasks = _load_tasks() + super().__init__(tasks.get(task_id, {})) + def __setitem__(self, key, value): + super().__setitem__(key, value) + with _task_lock: + tasks = _load_tasks() + if self._task_id not in tasks: + tasks[self._task_id] = {} + tasks[self._task_id][key] = value + _save_tasks(tasks) + TASKS = TasksProxy() # ========== UTILITY FUNCTIONS ========== diff --git a/index.html.final b/index.html.final index 6930367..1d12a82 100644 --- a/index.html.final +++ b/index.html.final @@ -2198,9 +2198,9 @@ function renderCoverage() { const x1 = ml + ((seg.startDate.getTime() - tMin) / tRange) * pw; const w = Math.max(2, ((seg.duration_sec || 0) / (tRange / 1000)) * pw); const color = lineColorMap[seg.line] || '#666'; - const escapedFn = seg.filename.replace(/'/g, "\\'"); + const escapedFn = (seg.filename||seg.name).replace(/'/g, "\\'"); svg += ``; - svg += `${seg.filename}\nBoard: ${seg.board_id || '?'}\nLine: ${seg.line || '?'} Point: ${seg.point || '?'}\nDuration: ${((seg.duration_sec || 0) / 3600).toFixed(1)}h\nStart: ${seg.date_str}`; + svg += `${(seg.filename||seg.name)}\nBoard: ${seg.board_id || '?'}\nLine: ${seg.line || '?'} Point: ${seg.point || '?'}\nDuration: ${((seg.duration_sec || 0) / 3600).toFixed(1)}h\nStart: ${seg.date_str}`; svg += ``; }); });