Remove now-unneeded code, change _total_coins to use _all_coins

This commit is contained in:
jesopo 2018-10-18 13:49:32 +01:00
parent c3fb63e03c
commit 8388c6e05a

View file

@ -88,8 +88,7 @@ class Module(ModuleManager.BaseModule):
user_coins = sum([decimal.Decimal(v) for v in wallet.values()]) user_coins = sum([decimal.Decimal(v) for v in wallet.values()])
coins[i] = (nickname, user_coins) coins[i] = (nickname, user_coins)
coins = list(filter(lambda coin: decimal.Decimal(coin[1]), coins)) return dict(filter(lambda coin: coin[1], coins))
return dict([(coin[0], decimal.Decimal(coin[1])) for coin in coins])
def _redeem_amount(self, server): def _redeem_amount(self, server):
return decimal.Decimal(server.get_setting("redeem-amount", return decimal.Decimal(server.get_setting("redeem-amount",
@ -141,11 +140,7 @@ class Module(ModuleManager.BaseModule):
self._coin_str(self._get_pool(event["server"]))) self._coin_str(self._get_pool(event["server"])))
def _total_coins(self, server): def _total_coins(self, server):
all_coins = server.get_all_user_settings("coins", []) all_coins = sum(self._all_coins(server).values())
all_coins = list(filter(lambda coin: decimal.Decimal(coin[1]),
all_coins))
all_coins = [decimal.Decimal(coin[1]) for coin in all_coins]
all_coins = sum(all_coins)
return self._get_pool(server)+all_coins return self._get_pool(server)+all_coins
@utils.hook("received.command.totalcoins") @utils.hook("received.command.totalcoins")