Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update Book relationship query #1459

Merged
merged 1 commit into from
May 24, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions salesforce/management/commands/update_opportunities.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def handle(self, *args, **options):
AdoptionOpportunityRecord.objects.all().delete()

# then we will get any new records
command = "SELECT Id, Contact__r.Accounts_UUID__c, Book_Text__c, Base_Year__c, IsWon, Fall_Students__c, Spring_Students__c, Summer_Students__c from Opportunity WHERE Contact__r.Accounts_UUID__c != null AND Base_Year__c = {} AND IsWon = True".format(year)
command = "SELECT Id, Contact__r.Accounts_UUID__c, Book__r.Name, Base_Year__c, IsWon, Fall_Students__c, Spring_Students__c, Summer_Students__c from Opportunity WHERE Contact__r.Accounts_UUID__c != null AND Base_Year__c = {} AND IsWon = True".format(year)

response = sf.query_all(command)
records = response['records']
Expand All @@ -28,8 +28,8 @@ def handle(self, *args, **options):
for record in records:
opportunity, created = AdoptionOpportunityRecord.objects.update_or_create(
opportunity_id=record['Id'],
defaults = {'account_uuid': record['Accounts_UUID__c'],
'book_name': record['Book_Text__c'],
defaults = {'account_uuid': record['Contact__r.Accounts_UUID__c'],
'book_name': record['Book__r.Name'],
'fall_student_number': record['Fall_Students__c'],
'spring_student_number': record['Spring_Students__c'],
'summer_student_number': record['Summer_Students__c'],
Expand Down