From 700ce8fef2dfbc4fec9f9a72395012ff9542237d Mon Sep 17 00:00:00 2001 From: hailin Date: Tue, 29 Oct 2024 11:29:53 +0800 Subject: [PATCH] . --- app.py | 17 +++++++++++------ templates/edit_customers.html | 2 +- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/app.py b/app.py index ffd8f14..b1d818a 100644 --- a/app.py +++ b/app.py @@ -170,22 +170,26 @@ def calculate_statistics(): total_emails = 0 cold_lead_count = 0 no_promotion_count = 0 + disqualified_lead_count = 0 # New variable to count disqualified leads - # 遍历所有客户数据以计算统计信息 + # Iterate over all customer data to calculate statistics for customer in customer_data: for domain, info in customer.items(): if 'email addresses' in info and isinstance(info['email addresses'], list): for email in info['email addresses']: total_emails += 1 - # 判断 "cold lead" 类型 + # Count "cold lead" type if email.get('category', '').lower() == "cold lead": cold_lead_count += 1 - # 判断是否有推广历史 + # Count "disqualified lead" type + if email.get('category', '').lower() == "disqualified lead": + disqualified_lead_count += 1 + # Check if there is a promotion history promotion_history = email.get('promotion history', []) - if not promotion_history: # 如果推广历史为空或不存在 + if not promotion_history: # If promotion history is empty or nonexistent no_promotion_count += 1 - return total_emails, cold_lead_count, no_promotion_count + return total_emails, cold_lead_count, no_promotion_count, disqualified_lead_count @app.route('/customer/') @@ -212,7 +216,7 @@ def view_customer(index): is_last = index == len(customer_data) - 1 # 调用统计函数,获取统计数据 - total_emails, cold_lead_count, no_promotion_count = calculate_statistics() + total_emails, cold_lead_count, no_promotion_count, disqualified_lead_count = calculate_statistics() # Call new function to count companies company_count = count_companies() @@ -225,6 +229,7 @@ def view_customer(index): total_emails=total_emails, cold_lead_count=cold_lead_count, no_promotion_count=no_promotion_count, + disqualified_lead_count=disqualified_lead_count, company_count=company_count) diff --git a/templates/edit_customers.html b/templates/edit_customers.html index 549bb16..a78fec5 100644 --- a/templates/edit_customers.html +++ b/templates/edit_customers.html @@ -84,7 +84,7 @@
-

Total Emails: {{ total_emails }} | Cold Leads: {{ cold_lead_count }} | No Promotion: {{ no_promotion_count }} | Total Companies: {{ company_count }}

+

Total Emails: {{ total_emails }} | Cold Leads: {{ cold_lead_count }} | No Promotion: {{ no_promotion_count }} | Disqualified Leads: {{ disqualified_lead_count }} | Total Companies: {{ company_count }}