- Fixed: Timeout not called upon initial coupling
- 'Cannot sell below purchased price' incorrectly shown when its actually valid order placement
- UI: parsing of get-rates API (latest update)
This commit is contained in:
sairajzero 2022-05-07 23:17:02 +05:30
parent 09953d252a
commit 838a12b361
2 changed files with 5 additions and 4 deletions

View File

@ -2294,7 +2294,8 @@
function updateRate(init = false, refreshButton) { function updateRate(init = false, refreshButton) {
if (refreshButton) if (refreshButton)
buttonLoader('wallet_balance_refresh_button', true); buttonLoader('wallet_balance_refresh_button', true);
floExchangeAPI.getRates().then(rates => { floExchangeAPI.getRates().then(result => {
let rates = result.rates;
console.debug(rates); console.debug(rates);
if (init) { if (init) {
floGlobals.exchangeRates = rates floGlobals.exchangeRates = rates

View File

@ -153,8 +153,8 @@ const checkSellRequirement = (floID, asset, quantity, min_price) => new Promise(
if (total < locked + quantity) if (total < locked + quantity)
reject(INVALID(`Insufficient sell-chips for ${asset}`)); reject(INVALID(`Insufficient sell-chips for ${asset}`));
else Promise.all([ else Promise.all([
DB.query("SELECT IFNULL(SUM(quantity), 0) AS total_chips FROM SellChips WHERE floID=? AND asset=? AND base>=?", [floID, asset, min_price]), DB.query("SELECT IFNULL(SUM(quantity), 0) AS total_chips FROM SellChips WHERE floID=? AND asset=? AND base<=?", [floID, asset, min_price]),
DB.query("SELECT IFNULL(SUM(quantity), 0) AS locked FROM SellOrder WHERE floID=? AND asset=? AND minPrice>=?", [floID, asset, min_price]) DB.query("SELECT IFNULL(SUM(quantity), 0) AS locked FROM SellOrder WHERE floID=? AND asset=? AND minPrice<=?", [floID, asset, min_price])
]).then(result => { ]).then(result => {
let g_total = result[0][0].total_chips, let g_total = result[0][0].total_chips,
g_locked = result[1][0].locked; g_locked = result[1][0].locked;
@ -675,7 +675,7 @@ function periodicProcess() {
periodicProcess.start = function() { periodicProcess.start = function() {
periodicProcess.stop(); periodicProcess.stop();
periodicProcess(); periodicProcess();
assetList.forEach(asset => coupling.initiate(asset)); assetList.forEach(asset => coupling.initiate(asset, true));
coupling.price.storeHistory.start(); coupling.price.storeHistory.start();
periodicProcess.instance = setInterval(periodicProcess, PERIOD_INTERVAL); periodicProcess.instance = setInterval(periodicProcess, PERIOD_INTERVAL);
}; };