This commit is contained in:
vdv committed 2023-02-03 11:59:40 +01:00
1 parent ccbcd12f96
commit 5658cc0556
6 files changed
+52 -36

No files matched your search

+15 -1
View File
@@ -276,7 +276,13 @@ export const pruneAndSaveImportedGpx = async (params: any) => {
];
} else {
gpxId = getUri('gpx', id);
previousGpx = (await getGpx(id)) ?? null;
previousGpx = (await getGpx({ id })) ?? null;
console.log({
caller: 'pruneAndSaveImportedGpx / previousGpx',
id,
previousGpx,
gpxId,
});
}
prune(gpxId, gpx, previousGpx, extensions, docs);
console.log({ caller: 'pruneAndSaveImportedGpx / pruned', docs });
@@ -375,6 +381,14 @@ export const getGpx = async (params: any) => {
// level 0
if (row.doc.type === 'gpx') {
if (!!gpx) {
console.error({
caller: 'getGpx',
id,
row,
target,
gpx,
});
return false; // Hack to stop if getFamily fails
}
target = [row.doc.doc];
+14 -2
View File
@@ -44,11 +44,23 @@ export const getFamily = async (
local: boolean = false
) => {
const targetDb = local ? localDb : db;
return await targetDb.allDocs({
const endkey = `${key}\ufff0`;
const allDocs = await targetDb.allDocs({
startkey: key,
endkey: `${key}\ufff0`,
endkey,
...options,
});
if (allDocs.rows.at(-1).id > endkey) {
console.error({
caller: 'getFamilly',
key,
endkey,
options,
local,
allDocs,
});
}
return allDocs;
};
export const get = async (id: string, local: boolean = false) => {
+7
View File
@@ -41,6 +41,13 @@ export const getRte = async (params: any) => {
// level 0
if (row.doc.type === 'rte') {
if (!!rte) {
console.error({
caller: 'getRte',
id,
row,
target,
rte,
});
return false; // Hack to stop if getFamily fails
}
target = [row.doc.doc];
+8
View File
@@ -41,6 +41,14 @@ export const getTrk = async (params: any) => {
// level 0
if (row.doc.type === 'trk') {
if (!!trk) {
console.error({
caller: 'getTrk',
id,
row,
target,
trk,
});
return false; // Hack to stop if getFamily fails
}
target = [row.doc.doc];
+8
View File
@@ -36,6 +36,14 @@ export const getTrkseg = async (params: any) => {
// level 0
if (row.doc.type === 'trkseg') {
if (!!trkseg) {
console.error({
caller: 'getTrkseg',
id,
row,
target,
trkseg,
});
return false; // Hack to stop if getFamily fails
}
target = [row.doc.doc];