This commit is contained in:
hailin 2024-10-29 11:29:53 +08:00
parent 32680e29b9
commit 700ce8fef2
2 changed files with 12 additions and 7 deletions

17
app.py
View File

@ -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/<int:index>')
@ -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)

View File

@ -84,7 +84,7 @@
<!-- Fixed status bar -->
<div class="status-bar">
<p>Total Emails: {{ total_emails }} | Cold Leads: {{ cold_lead_count }} | No Promotion: {{ no_promotion_count }} | Total Companies: {{ company_count }}</p>
<p>Total Emails: {{ total_emails }} | Cold Leads: {{ cold_lead_count }} | No Promotion: {{ no_promotion_count }} | Disqualified Leads: {{ disqualified_lead_count }} | Total Companies: {{ company_count }}</p>
</div>
<!-- JavaScript for navigation functions -->