Allowing multiple Gpx files import

This commit is contained in:
vdv committed 2022-12-10 21:25:15 +01:00
1 parent 86a8c823f1
commit 882e5545fd
3 files changed
+60 -41

No files matched your search

+12 -4
View File
@@ -72,12 +72,20 @@ const prune = (id: any, object: any, docs: any[]) => {
key === 'trkpt'
) {
const subObjects = object[key];
let previousId = 0;
for (const index in subObjects) {
const subId = { ...id };
subId[key] =
key === 'trkpt'
? intToTrkptId(new Date(object[key][index].time).valueOf())
: index;
if (key === 'trkpt') {
// fix buggy times in GPX tracks
const normalId = intToTrkptId(
new Date(object[key][index].time).valueOf()
);
const id = normalId > previousId ? normalId : previousId + 1;
subId[key] = id;
previousId = id;
} else {
subId[key] = index;
}
// console.log({
// caller: 'prune',
// id,
+1 -1
View File
@@ -25,7 +25,7 @@ export const initDb = async (params: any) => {
if (globalThis.db === undefined) {
globalThis.db = new PouchDB('dyomedea', {
auto_compaction: false,
revs_limit: 10,
// revs_limit: 10,
});
}
const db = globalThis.db;