Skip to content

Commit

Permalink
Handle unsupported submission states
Browse files Browse the repository at this point in the history
  • Loading branch information
rixx committed Nov 15, 2024
1 parent 6669a10 commit 48f8216
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion pretalx_salesforce/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 48f8216

Please sign in to comment.