Dineshpopuri commited on
Commit
bb63e0d
·
verified ·
1 Parent(s): 3473329

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -3
app.py CHANGED
@@ -282,8 +282,10 @@ def evaluate_readiness(logs, qa_report, punch_list_text):
282
  # Calculate open punch items
283
  open_punch_items = 0 if punch_pass else len(punch_list_text.split(",")) if punch_list_text else 1
284
 
285
- # Handle critical issues (escalation)
286
- escalated = any("incomplete" in item.lower() or "missing" in item.lower() for item in missing_items)
 
 
287
  # Map "Pending" to "In Progress" for Salesforce Status__c picklist
288
  status = "Escalated" if escalated else ("Completed" if not missing_items else "In Progress")
289
  checklist_status = "Escalated" if escalated else ("Completed" if not missing_items else "Pending") # For UI display
@@ -347,7 +349,7 @@ def generate_pdf(score, checklist_summary, missing_summary, checklist_status, lo
347
  BOTTOM_MARGIN = 50 # Minimum Y position before creating a new page
348
  for line in checklist_summary.split("\n"):
349
  if y < BOTTOM_MARGIN:
350
- logging.info("Y position below margin, creating new page")
351
  c.showPage() # Create a new page
352
  c.setFont("Times-Roman", 12) # Reset font for new page
353
  y = 750 # Reset Y position
 
282
  # Calculate open punch items
283
  open_punch_items = 0 if punch_pass else len(punch_list_text.split(",")) if punch_list_text else 1
284
 
285
+ # Enhanced escalation logic: escalate if score is below 70% or open punch items are more than 2
286
+ escalated = score < 70 or open_punch_items > 2
287
+ logging.info(f"Escalation Check: Score < 70 ({score < 70}), Open Punch Items > 2 ({open_punch_items > 2}), Escalated: {escalated}")
288
+
289
  # Map "Pending" to "In Progress" for Salesforce Status__c picklist
290
  status = "Escalated" if escalated else ("Completed" if not missing_items else "In Progress")
291
  checklist_status = "Escalated" if escalated else ("Completed" if not missing_items else "Pending") # For UI display
 
349
  BOTTOM_MARGIN = 50 # Minimum Y position before creating a new page
350
  for line in checklist_summary.split("\n"):
351
  if y < BOTTOM_MARGIN:
352
+ logging.info "Y position below margin, creating new page")
353
  c.showPage() # Create a new page
354
  c.setFont("Times-Roman", 12) # Reset font for new page
355
  y = 750 # Reset Y position