diff --git a/core/clients/platform.py b/core/clients/platform.py index bc3d59f..4faeec0 100644 --- a/core/clients/platform.py +++ b/core/clients/platform.py @@ -901,7 +901,7 @@ class LocalPlatformClient(ABC): "ad_id": ad_id, } log.info(f"Storing trade information: {str(trade_cast)}") - trade = self.instance.new_trade(trade_cast) + self.instance.new_trade(trade_cast) # await db.r.hmset(f"trade.{reference}", to_store) # await db.r.set(f"trade.{trade_id}.reference", reference) message = f"Generated reference for {trade_id}: {reference}" @@ -915,12 +915,13 @@ class LocalPlatformClient(ABC): # else: # User is verified # log.info(f"UID {uid} is verified.") ad_obj = self.instance.get_ad(ad_id) - if not ad_obj: - log.error(f"Could not get ad object for {ad_id}.") - return + if ad_obj: + await self.send_bank_details(currency, trade_id, ad_obj) + await self.send_reference(trade_id, reference) + else: + log.warning(f"Could not get ad object for {ad_id}.") + # return - await self.send_bank_details(currency, trade_id, ad_obj) - await self.send_reference(trade_id, reference) if existing_ref: return existing_ref else: diff --git a/core/models.py b/core/models.py index 2afd692..64b841e 100644 --- a/core/models.py +++ b/core/models.py @@ -208,6 +208,14 @@ class Platform(models.Model): return references + @property + def trades(self): + """ + Get all our open trades. + """ + our_trades = Trade.objects.filter(platform=self, open=True) + return our_trades + def contact_id_to_reference(self, contact_id): """ Get a reference from a contact_id. diff --git a/core/templates/partials/platform-trades.html b/core/templates/partials/platform-trades.html index d34ad60..26b496f 100644 --- a/core/templates/partials/platform-trades.html +++ b/core/templates/partials/platform-trades.html @@ -19,7 +19,6 @@
{{ item.reference }}