statistics

This commit is contained in:
vcoppe
2025-10-18 00:31:14 +02:00
parent a73da0d81d
commit de81a8940e
13 changed files with 151 additions and 122 deletions

View File

@@ -2,12 +2,12 @@ import { updateAnchorPoints } from '$lib/components/toolbar/tools/routing/Simpli
import { db, type Database } from '$lib/db';
import { liveQuery } from 'dexie';
import { GPXFile } from 'gpx';
import { GPXStatisticsTree, type GPXFileWithStatistics } from '$lib/logic/statistics';
import { GPXStatisticsTree, type GPXFileWithStatistics } from '$lib/logic/statistics-tree';
import { settings } from '$lib/logic/settings';
import { get, writable, type Subscriber, type Writable } from 'svelte/store';
// Observe a single file from the database, and maintain its statistics
class GPXFileState {
export class GPXFileState {
private _file: Writable<GPXFileWithStatistics | undefined>;
private _subscription: { unsubscribe: () => void } | undefined;
@@ -119,6 +119,10 @@ export class GPXFileStateCollection {
return get(this._files).size;
}
getFileState(fileId: string): GPXFileState | undefined {
return get(this._files).get(fileId);
}
getFile(fileId: string): GPXFile | undefined {
let fileState = get(this._files).get(fileId);
return fileState?.file;