From 48f821601b8a1390be5ff0229a24cf5a83e7b436 Mon Sep 17 00:00:00 2001 From: Tobias Kunze Date: Fri, 15 Nov 2024 01:09:23 +0100 Subject: [PATCH] Handle unsupported submission states --- pretalx_salesforce/models.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pretalx_salesforce/models.py b/pretalx_salesforce/models.py index cfd8385..69743c0 100644 --- a/pretalx_salesforce/models.py +++ b/pretalx_salesforce/models.py @@ -121,13 +121,19 @@ class SubmissionSalesforceSync(models.Model): salesforce_id = models.CharField(max_length=255, null=True, blank=True) synced_data = models.JSONField(null=True, blank=True, default=dict) + @property + def serialized_state(self): + if self.submission.state in ("submitted", "accepted", "rejected", "confirmed"): + return self.submission.state.capitalize() + return "Rejected" + def serialize(self): return { # "CreatedDate": self.submission.created.strftime("%Y-%m-%dT%H:%M:%SZ"), "pretalx_LegacyID__c": self.submission.code, "Name": ellipsis(self.submission.title, 80), "Track__c": str(self.submission.track.name), - "Status__c": self.submission.state.capitalize(), + "Status__c": self.serialized_state, "Abstract__c": ( (self.submission.abstract or "") + "\n"