diff options
Diffstat (limited to 'packages/taler-wallet-core/src')
-rw-r--r-- | packages/taler-wallet-core/src/db.ts | 5 | ||||
-rw-r--r-- | packages/taler-wallet-core/src/util/denominations.ts | 19 |
2 files changed, 15 insertions, 9 deletions
diff --git a/packages/taler-wallet-core/src/db.ts b/packages/taler-wallet-core/src/db.ts index 5a2e493b5..bbd93f669 100644 --- a/packages/taler-wallet-core/src/db.ts +++ b/packages/taler-wallet-core/src/db.ts @@ -2258,7 +2258,10 @@ export async function importDb(db: IDBDatabase, object: any): Promise<void> { dump.stores[name] = storeDump; talerDb.objectStores[name].records.map((r: any) => { const pkey = r.primaryKey; - const key = typeof pkey === "string" ? pkey : pkey.join(","); + const key = + typeof pkey === "string" || typeof pkey === "number" + ? pkey + : pkey.join(","); storeDump[key] = r.value; }); } diff --git a/packages/taler-wallet-core/src/util/denominations.ts b/packages/taler-wallet-core/src/util/denominations.ts index 639f53895..ef35fe198 100644 --- a/packages/taler-wallet-core/src/util/denominations.ts +++ b/packages/taler-wallet-core/src/util/denominations.ts @@ -93,11 +93,11 @@ export function createPairTimeline( left: FeeDescription[], right: FeeDescription[], ): FeeDescriptionPair[] { - //FIXME: we need to create a copy of the array because - //this algorithm is using splice, remove splice and + //FIXME: we need to create a copy of the array because + //this algorithm is using splice, remove splice and //remove this array duplication - left = [...left] - right = [...right] + left = [...left]; + right = [...right]; //both list empty, discarded if (left.length === 0 && right.length === 0) return []; @@ -108,7 +108,10 @@ export function createPairTimeline( let ri = 0; //right list index while (li < left.length && ri < right.length) { - const currentGroup = Number.parseFloat(left[li].group) < Number.parseFloat(right[ri].group) ? left[li].group : right[ri].group; + const currentGroup = + Number.parseFloat(left[li].group) < Number.parseFloat(right[ri].group) + ? left[li].group + : right[ri].group; const lgs = li; //left group start index const rgs = ri; //right group start index @@ -182,7 +185,7 @@ export function createPairTimeline( } //now both lists are non empty and (starts,ends) at the same time - while (li < (lgs + lgl) && ri < (rgs + rgl)) { + while (li < lgs + lgl && ri < rgs + rgl) { if ( AbsoluteTime.cmp(left[li].from, timeCut) !== 0 && AbsoluteTime.cmp(right[ri].from, timeCut) !== 0 @@ -233,7 +236,7 @@ export function createPairTimeline( if (li < left.length) { let timeCut = pairList.length > 0 && - pairList[pairList.length - 1].group === left[li].group + pairList[pairList.length - 1].group === left[li].group ? pairList[pairList.length - 1].until : left[li].from; while (li < left.length) { @@ -251,7 +254,7 @@ export function createPairTimeline( if (ri < right.length) { let timeCut = pairList.length > 0 && - pairList[pairList.length - 1].group === right[ri].group + pairList[pairList.length - 1].group === right[ri].group ? pairList[pairList.length - 1].until : right[ri].from; while (ri < right.length) { |