This commit is contained in:
parent
32680e29b9
commit
700ce8fef2
17
app.py
17
app.py
|
|
@ -170,22 +170,26 @@ def calculate_statistics():
|
||||||
total_emails = 0
|
total_emails = 0
|
||||||
cold_lead_count = 0
|
cold_lead_count = 0
|
||||||
no_promotion_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 customer in customer_data:
|
||||||
for domain, info in customer.items():
|
for domain, info in customer.items():
|
||||||
if 'email addresses' in info and isinstance(info['email addresses'], list):
|
if 'email addresses' in info and isinstance(info['email addresses'], list):
|
||||||
for email in info['email addresses']:
|
for email in info['email addresses']:
|
||||||
total_emails += 1
|
total_emails += 1
|
||||||
# 判断 "cold lead" 类型
|
# Count "cold lead" type
|
||||||
if email.get('category', '').lower() == "cold lead":
|
if email.get('category', '').lower() == "cold lead":
|
||||||
cold_lead_count += 1
|
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', [])
|
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
|
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>')
|
@app.route('/customer/<int:index>')
|
||||||
|
|
@ -212,7 +216,7 @@ def view_customer(index):
|
||||||
is_last = index == len(customer_data) - 1
|
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
|
# Call new function to count companies
|
||||||
company_count = count_companies()
|
company_count = count_companies()
|
||||||
|
|
@ -225,6 +229,7 @@ def view_customer(index):
|
||||||
total_emails=total_emails,
|
total_emails=total_emails,
|
||||||
cold_lead_count=cold_lead_count,
|
cold_lead_count=cold_lead_count,
|
||||||
no_promotion_count=no_promotion_count,
|
no_promotion_count=no_promotion_count,
|
||||||
|
disqualified_lead_count=disqualified_lead_count,
|
||||||
company_count=company_count)
|
company_count=company_count)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -84,7 +84,7 @@
|
||||||
|
|
||||||
<!-- Fixed status bar -->
|
<!-- Fixed status bar -->
|
||||||
<div class="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>
|
</div>
|
||||||
|
|
||||||
<!-- JavaScript for navigation functions -->
|
<!-- JavaScript for navigation functions -->
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue