From 49c417b61d1a23a1a63983054fa00464f5f5ff94 Mon Sep 17 00:00:00 2001 From: Alexander Bai Date: Mon, 21 Sep 2020 17:00:14 -0400 Subject: [PATCH] server: Fixed formatting of StatisticsService --- .../explorer/services/StatisticsService.scala | 22 +++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/server/app/com/xsn/explorer/services/StatisticsService.scala b/server/app/com/xsn/explorer/services/StatisticsService.scala index 6ec3c396..3641fbc1 100644 --- a/server/app/com/xsn/explorer/services/StatisticsService.scala +++ b/server/app/com/xsn/explorer/services/StatisticsService.scala @@ -7,7 +7,11 @@ import com.alexitc.playsonify.core.FutureOr.Implicits._ import com.xsn.explorer.data.async.{StatisticsFutureDataHandler, BalanceFutureDataHandler} import com.xsn.explorer.models.{MarketStatistics, StatisticsDetails, NodeStatistics, SynchronizationProgress} import com.xsn.explorer.tasks.CurrencySynchronizerActor -import com.xsn.explorer.services.synchronizer.repository.{MasternodeRepository, MerchantnodeRepository, NodeStatsRepository} +import com.xsn.explorer.services.synchronizer.repository.{ + MasternodeRepository, + MerchantnodeRepository, + NodeStatsRepository +} import javax.inject.Inject import org.scalactic.{Bad, Good} import akka.util.Timeout @@ -53,8 +57,15 @@ class StatisticsService @Inject()( tposProtocols <- merchantnodeRepository.getProtocols() coinsStaking <- nodeStatsRepository.getCoinsStaking() } yield { - val stats = NodeStatistics(masternodes = mnCount, enabledMasternodes = mnEnabledCount, masternodesProtocols = mnProtocols, - tposnodes = tposCount, enabledTposnodes = tposEnabledCount, tposnodesProtocols = tposProtocols, coinsStaking = coinsStaking) + val stats = NodeStatistics( + masternodes = mnCount, + enabledMasternodes = mnEnabledCount, + masternodesProtocols = mnProtocols, + tposnodes = tposCount, + enabledTposnodes = tposEnabledCount, + tposnodesProtocols = tposProtocols, + coinsStaking = coinsStaking + ) Good(stats) } } @@ -65,7 +76,10 @@ class StatisticsService @Inject()( val result = for { tposNodesList <- tposNodes.map(x => Good(x)).toFutureOr - tposAddressList <- tposNodesList.map(t => t.payee).map(statisticsFutureDataHandler.getTPoSMerchantStakingAddresses).toFutureOr + tposAddressList <- tposNodesList + .map(t => t.payee) + .map(statisticsFutureDataHandler.getTPoSMerchantStakingAddresses) + .toFutureOr coinsStaking <- tposAddressList.flatten.map(balanceFutureDataHandler.getBy).toFutureOr coinsStakingSum = coinsStaking.map(t => t.available).sum } yield coinsStakingSum