Swathi6 commited on
Commit
5867e70
·
verified ·
1 Parent(s): 4be0bfd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -1
app.py CHANGED
@@ -122,6 +122,11 @@ def fetch_vendor_logs_from_salesforce():
122
  if not record['Vendor__c']:
123
  logger.warning(f"Skipping Vendor_Log__c record with ID {record['Id']} due to missing Vendor__c")
124
  continue
 
 
 
 
 
125
  log = VendorLog(
126
  vendorLogId=record.get('Id', 'Unknown'),
127
  vendorId=record.get('Name', 'Unknown'),
@@ -132,7 +137,7 @@ def fetch_vendor_logs_from_salesforce():
132
  workCompletionDate=record.get('Work_Completion_Date__c', 'N/A'),
133
  actualCompletionDate=record.get('Actual_Completion_Date__c', 'N/A'),
134
  vendorLogName=record.get('Name', 'Unknown'),
135
- delayDays=int(record.get('Delay_Days__c', 0)),
136
  project=record.get('Project__c', 'Unknown')
137
  )
138
  logs.append(log)
 
122
  if not record['Vendor__c']:
123
  logger.warning(f"Skipping Vendor_Log__c record with ID {record['Id']} due to missing Vendor__c")
124
  continue
125
+ # Handle null or missing Delay_Days__c
126
+ delay_days = record.get('Delay_Days__c')
127
+ if delay_days is None:
128
+ logger.warning(f"Delay_Days__c is null for record ID {record['Id']}, defaulting to 0")
129
+ delay_days = 0
130
  log = VendorLog(
131
  vendorLogId=record.get('Id', 'Unknown'),
132
  vendorId=record.get('Name', 'Unknown'),
 
137
  workCompletionDate=record.get('Work_Completion_Date__c', 'N/A'),
138
  actualCompletionDate=record.get('Actual_Completion_Date__c', 'N/A'),
139
  vendorLogName=record.get('Name', 'Unknown'),
140
+ delayDays=int(delay_days),
141
  project=record.get('Project__c', 'Unknown')
142
  )
143
  logs.append(log)