diff --git a/lib/new-settings-loader.js b/lib/new-settings-loader.js index 2f812c51..139b0415 100644 --- a/lib/new-settings-loader.js +++ b/lib/new-settings-loader.js @@ -27,10 +27,13 @@ const accountsSql = `update user_config set data = $2, valid = $3, schema_versio insert into user_config (type, data, valid, schema_version) select $1, $2, $3, $4 where $1 not in (select type from user_config)` function saveAccounts (accounts) { - return loadAccounts() - .then(currentAccounts => { + return Promise.all([loadAccounts(), getOperatorId('middleware')]) + .then(([currentAccounts, operatorId]) => { const newAccounts = _.merge(currentAccounts, accounts) - return db.none(accountsSql, ['accounts', { accounts: newAccounts }, true, NEW_SETTINGS_LOADER_SCHEMA_VERSION]) + return db.tx(t => { + return t.none(accountsSql, ['accounts', { accounts: newAccounts }, true, NEW_SETTINGS_LOADER_SCHEMA_VERSION]) + .then(() => t.none('NOTIFY $1:name, $2', ['reload', JSON.stringify({ schema: asyncLocalStorage.getStore().get('schema'), operatorId })])) + }).catch(console.error) }) } function resetAccounts (schemaVersion) { diff --git a/new-lamassu-admin/src/pages/Transactions/DetailsCard.js b/new-lamassu-admin/src/pages/Transactions/DetailsCard.js index aa4602da..6e6c4eb1 100644 --- a/new-lamassu-admin/src/pages/Transactions/DetailsCard.js +++ b/new-lamassu-admin/src/pages/Transactions/DetailsCard.js @@ -202,10 +202,10 @@ const DetailsRow = ({ it: tx, timezone }) => { r={3.5} fill={ it < tx.walletScore - ? !R.includes('score is above', tx.hasError ?? '') + ? R.isNil(tx.hasError) ? primaryColor : errorColor - : !R.includes('score is above', tx.hasError ?? '') + : R.isNil(tx.hasError) ? subheaderColor : offErrorColor } @@ -218,7 +218,7 @@ const DetailsRow = ({ it: tx, timezone }) => { noMargin className={classNames({ [classes.bold]: true, - [classes.error]: R.includes('score is above', tx.hasError ?? '') + [classes.error]: !R.isNil(tx.hasError) })}> {tx.walletScore}