From 1a0f22740b6ee2a603dab512b8a5c84f6e57b6a8 Mon Sep 17 00:00:00 2001 From: Mark Veidemanis Date: Wed, 17 May 2023 07:17:36 +0100 Subject: [PATCH] Fix sending totals to ES --- core/lib/money.py | 6 +++--- core/views/profit.py | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/core/lib/money.py b/core/lib/money.py index 49e3813..74ea149 100644 --- a/core/lib/money.py +++ b/core/lib/money.py @@ -85,8 +85,8 @@ class Money(object): cast["type"] = "money" cast["ts"] = str(datetime.now().isoformat()) cast["xtype"] = msgtype - cast["user_id"] = self.instance.user.id - cast["platform_id"] = self.instance.id + # cast["user_id"] = self.instance.user.id + # cast["platform_id"] = self.instance.id await self.es.index(index=settings.ELASTICSEARCH_INDEX, body=cast) async def lookup_rates(self, platform, ads, rates=None): @@ -403,7 +403,7 @@ class Money(object): cast_es["total_remaining"] = total_remaining cast_es["total_profit"] = total_profit cast_es["total_profit_in_xmr"] = total_profit_in_xmr - # await self.write_to_es("get_total", cast_es) + await self.write_to_es("get_total", cast_es) return cast_es async def open_trades_usd_parse_dash(self, dash, rates): diff --git a/core/views/profit.py b/core/views/profit.py index 23deb24..0709a8f 100644 --- a/core/views/profit.py +++ b/core/views/profit.py @@ -22,7 +22,8 @@ class Profit(LoginRequiredMixin, OTPRequiredMixin, ObjectRead): ) ) for key in res.keys(): - res[key] = round(res[key], 2) + if type(res[key]) != str: + res[key] = round(res[key], 2) results = { "Bank balance total": res["total_sinks_usd"], "Platform balance total": res["total_usd_agora"],