@@ -7,7 +7,11 @@ import com.alexitc.playsonify.core.FutureOr.Implicits._
77import com .xsn .explorer .data .async .{StatisticsFutureDataHandler , BalanceFutureDataHandler }
88import com .xsn .explorer .models .{MarketStatistics , StatisticsDetails , NodeStatistics , SynchronizationProgress }
99import com .xsn .explorer .tasks .CurrencySynchronizerActor
10- import com .xsn .explorer .services .synchronizer .repository .{MasternodeRepository , MerchantnodeRepository , NodeStatsRepository }
10+ import com .xsn .explorer .services .synchronizer .repository .{
11+ MasternodeRepository ,
12+ MerchantnodeRepository ,
13+ NodeStatsRepository
14+ }
1115import javax .inject .Inject
1216import org .scalactic .{Bad , Good }
1317import akka .util .Timeout
@@ -53,8 +57,15 @@ class StatisticsService @Inject()(
5357 tposProtocols <- merchantnodeRepository.getProtocols()
5458 coinsStaking <- nodeStatsRepository.getCoinsStaking()
5559 } yield {
56- val stats = NodeStatistics (masternodes = mnCount, enabledMasternodes = mnEnabledCount, masternodesProtocols = mnProtocols,
57- tposnodes = tposCount, enabledTposnodes = tposEnabledCount, tposnodesProtocols = tposProtocols, coinsStaking = coinsStaking)
60+ val stats = NodeStatistics (
61+ masternodes = mnCount,
62+ enabledMasternodes = mnEnabledCount,
63+ masternodesProtocols = mnProtocols,
64+ tposnodes = tposCount,
65+ enabledTposnodes = tposEnabledCount,
66+ tposnodesProtocols = tposProtocols,
67+ coinsStaking = coinsStaking
68+ )
5869 Good (stats)
5970 }
6071 }
@@ -65,7 +76,10 @@ class StatisticsService @Inject()(
6576 val result = for {
6677 tposNodesList <- tposNodes.map(x => Good (x)).toFutureOr
6778
68- tposAddressList <- tposNodesList.map(t => t.payee).map(statisticsFutureDataHandler.getTPoSMerchantStakingAddresses).toFutureOr
79+ tposAddressList <- tposNodesList
80+ .map(t => t.payee)
81+ .map(statisticsFutureDataHandler.getTPoSMerchantStakingAddresses)
82+ .toFutureOr
6983 coinsStaking <- tposAddressList.flatten.map(balanceFutureDataHandler.getBy).toFutureOr
7084 coinsStakingSum = coinsStaking.map(t => t.available).sum
7185 } yield coinsStakingSum
0 commit comments