Skip to content

Commit

Permalink
[loading] refs #295 Quit loading mark only when fully loaded
Browse files Browse the repository at this point in the history
  • Loading branch information
stdevMac committed Jan 18, 2020
1 parent 78bd2d2 commit 07c30f7
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/models/modelWallets.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ func (m *ModelWallets) loadModel() {
m.BeginResetModel()
logWalletModel.Info("Loading Model")
m.SetLoading(true)
fullyLoad := true
aModels := make([]*ModelAddresses, 0)
wallets := m.WalletEnv.GetWalletSet().ListWallets()
if wallets == nil {
Expand All @@ -127,6 +128,7 @@ func (m *ModelWallets) loadModel() {
outputs := a.GetCryptoAccount().ScanUnspentOutputs()
if outputs == nil {
logWalletModel.WithField("address", a.String()).Warn("Couldn't get unspent outputs")
fullyLoad = false
continue
}
mo := NewModelOutputs(nil)
Expand All @@ -140,23 +142,27 @@ func (m *ModelWallets) loadModel() {
val, err := to.GetCoins(coin.Sky)
if err != nil {
logWalletModel.WithError(nil).Warn("Couldn't get " + coin.Sky + " coins")
fullyLoad = false
continue
}
accuracy, err := util.AltcoinQuotient(coin.Sky)
if err != nil {
logWalletModel.WithError(err).Warn("Couldn't get " + coin.Sky + " coins quotient")
fullyLoad = false
continue
}
coins := util.FormatCoins(val, accuracy)
qo.SetAddressSky(coins)
val, err = to.GetCoins(coin.CoinHoursTicker)
if err != nil {
logWalletModel.WithError(err).Warn("Couldn't get " + coin.CoinHoursTicker + " coins")
fullyLoad = false
continue
}
accuracy, err = util.AltcoinQuotient(coin.CoinHoursTicker)
if err != nil {
logWalletModel.WithError(err).Warn("Couldn't get " + coin.CoinHoursTicker + " coins quotient")
fullyLoad = false
continue
}
coinsH := util.FormatCoins(val, accuracy)
Expand All @@ -173,7 +179,9 @@ func (m *ModelWallets) loadModel() {
}
logWalletModel.Info("Model loaded")
m.addAddresses(aModels)
m.SetLoading(false)
if fullyLoad {
m.SetLoading(false)
}
m.EndResetModel()
}

Expand Down

0 comments on commit 07c30f7

Please sign in to comment.