Skip to content

Commit

Permalink
More #2801 Stuff
Browse files Browse the repository at this point in the history
- Remove the empty string offline currency payout upon read.
  - Immediately re-write the file without the poorly-typed value.
- Remove the empty string offline currency payout upon import, before it
  actually gets added or updated.
  • Loading branch information
phroggster committed Sep 27, 2024
1 parent 602ddd0 commit 48eb0ba
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/backend/currency/currency-access.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,19 @@ class CurrencyAccess {

logger.debug("Refreshing currency cache");
const db = profileManager.getJsonDbInProfile("/currency/currency");
this._currencyCache = db.getData("/");

let issue2801 = false;
const cache = db.getData("/");
Object.keys(cache).forEach((currencyId) => {
if (cache[currencyId].offline === "") {
issue2801 = true;
cache[currencyId].offline = undefined;
}
});
if (issue2801) {
db.push("/", cache);
}
this._currencyCache = cache;
}

getCurrencies(): CurrencyCache {
Expand Down
4 changes: 4 additions & 0 deletions src/gui/app/services/currency.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,10 @@
return;
}

if (currency.offline === "") {
currency.offline = undefined;
}

if (service.getCurrency(currency.id)) {
service.updateCurrency(currency);
} else {
Expand Down

0 comments on commit 48eb0ba

Please sign in to comment.