Skip to content

Commit

Permalink
do not attempt to upload 0 resources
Browse files Browse the repository at this point in the history
  • Loading branch information
mwvolo committed Sep 9, 2024
1 parent a9fe7da commit ac5d317
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions salesforce/management/commands/update_resource_downloads.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
from django.core.management.base import BaseCommand
#from django.db import transaction
from salesforce.models import ResourceDownload
from salesforce.salesforce import Salesforce
#from simple_salesforce.exceptions import SalesforceResourceNotFound
from django.utils import timezone
from datetime import timedelta

Expand Down Expand Up @@ -32,7 +30,8 @@ def handle(self, *args, **options):
'Accounts_UUID__c': str(nrd.account_uuid)}
new_data.append(data_dict_item)

new_results = sf.bulk.Resource__c.insert(new_data)
if len(new_data) > 0:
new_results = sf.bulk.Resource__c.insert(new_data)

response = self.style.SUCCESS("SF Resource Download Completed. Sent: {}.".format(len(new_data)))
self.stdout.write(response)

0 comments on commit ac5d317

Please sign in to comment.