Fix sending totals to ES

This commit is contained in:
Mark Veidemanis 2023-05-17 07:17:36 +01:00
parent e934e7b1a2
commit 1a0f22740b
Signed by: m
GPG Key ID: 5ACFCEED46C0904F
2 changed files with 5 additions and 4 deletions

View File

@ -85,8 +85,8 @@ class Money(object):
cast["type"] = "money" cast["type"] = "money"
cast["ts"] = str(datetime.now().isoformat()) cast["ts"] = str(datetime.now().isoformat())
cast["xtype"] = msgtype cast["xtype"] = msgtype
cast["user_id"] = self.instance.user.id # cast["user_id"] = self.instance.user.id
cast["platform_id"] = self.instance.id # cast["platform_id"] = self.instance.id
await self.es.index(index=settings.ELASTICSEARCH_INDEX, body=cast) await self.es.index(index=settings.ELASTICSEARCH_INDEX, body=cast)
async def lookup_rates(self, platform, ads, rates=None): 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_remaining"] = total_remaining
cast_es["total_profit"] = total_profit cast_es["total_profit"] = total_profit
cast_es["total_profit_in_xmr"] = total_profit_in_xmr 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 return cast_es
async def open_trades_usd_parse_dash(self, dash, rates): async def open_trades_usd_parse_dash(self, dash, rates):

View File

@ -22,7 +22,8 @@ class Profit(LoginRequiredMixin, OTPRequiredMixin, ObjectRead):
) )
) )
for key in res.keys(): for key in res.keys():
res[key] = round(res[key], 2) if type(res[key]) != str:
res[key] = round(res[key], 2)
results = { results = {
"Bank balance total": res["total_sinks_usd"], "Bank balance total": res["total_sinks_usd"],
"Platform balance total": res["total_usd_agora"], "Platform balance total": res["total_usd_agora"],