diff --git a/server/app/com/xsn/explorer/data/anorm/dao/StatisticsPostgresDAO.scala b/server/app/com/xsn/explorer/data/anorm/dao/StatisticsPostgresDAO.scala index 1f5b211..42b8b45 100644 --- a/server/app/com/xsn/explorer/data/anorm/dao/StatisticsPostgresDAO.scala +++ b/server/app/com/xsn/explorer/data/anorm/dao/StatisticsPostgresDAO.scala @@ -26,10 +26,7 @@ class StatisticsPostgresDAO { """.stripMargin ).as(StatisticsParsers.parseStatistics.single) - val shiftBy = BigDecimal(6000000) - val totalSupply = result.totalSupply.map(x => (x - shiftBy) max 0) - val circulatingSupply = result.circulatingSupply.map(x => (x - shiftBy) max 0) - result.copy(totalSupply = totalSupply, circulatingSupply = circulatingSupply) + result } } diff --git a/server/test/com/xsn/explorer/data/StatisticsPostgresDataHandlerSpec.scala b/server/test/com/xsn/explorer/data/StatisticsPostgresDataHandlerSpec.scala index b7690d1..0a1c7d6 100644 --- a/server/test/com/xsn/explorer/data/StatisticsPostgresDataHandlerSpec.scala +++ b/server/test/com/xsn/explorer/data/StatisticsPostgresDataHandlerSpec.scala @@ -33,6 +33,7 @@ class StatisticsPostgresDataHandlerSpec extends PostgresDataHandlerSpec { } val balance = Balance(hiddenAddress, received = BigDecimal(1000), spent = BigDecimal(500)) + setAvailableCoins(balance.available) balanceDataHandler.upsert(balance).isGood mustEqual true val result = dataHandler.getStatistics().get @@ -45,10 +46,23 @@ class StatisticsPostgresDataHandlerSpec extends PostgresDataHandlerSpec { val totalSupply = dataHandler.getStatistics().get.totalSupply.getOrElse(0) val balance = Balance(burnAddress, received = BigDecimal(1000), spent = BigDecimal(500)) + setAvailableCoins(balance.available) balanceDataHandler.upsert(balance).isGood mustEqual true val result = dataHandler.getStatistics().get result.totalSupply.value mustEqual totalSupply } } + + private def setAvailableCoins(total: BigDecimal) = { + database.withConnection { implicit conn => + _root_.anorm.SQL( + s""" + |UPDATE aggregated_amounts + |SET value = value + $total + |WHERE name = 'available_coins' + """.stripMargin + ).executeUpdate() + } + } }