This commit is contained in:
parent
700ce8fef2
commit
65c23e8173
20
app.py
20
app.py
|
|
@ -170,7 +170,9 @@ def calculate_statistics():
|
|||
total_emails = 0
|
||||
cold_lead_count = 0
|
||||
no_promotion_count = 0
|
||||
disqualified_lead_count = 0 # New variable to count disqualified leads
|
||||
disqualified_lead_count = 0
|
||||
english_cold_lead_count = 0 # Field for English "cold lead" customers
|
||||
chinese_cold_lead_count = 0 # Field for Chinese "cold lead" customers
|
||||
|
||||
# Iterate over all customer data to calculate statistics
|
||||
for customer in customer_data:
|
||||
|
|
@ -181,6 +183,12 @@ def calculate_statistics():
|
|||
# Count "cold lead" type
|
||||
if email.get('category', '').lower() == "cold lead":
|
||||
cold_lead_count += 1
|
||||
# Check language-specific cold leads
|
||||
language = email.get('language', 'en') # Default to English if language is absent or other
|
||||
if language == 'cn':
|
||||
chinese_cold_lead_count += 1
|
||||
else:
|
||||
english_cold_lead_count += 1
|
||||
# Count "disqualified lead" type
|
||||
if email.get('category', '').lower() == "disqualified lead":
|
||||
disqualified_lead_count += 1
|
||||
|
|
@ -189,7 +197,9 @@ def calculate_statistics():
|
|||
if not promotion_history: # If promotion history is empty or nonexistent
|
||||
no_promotion_count += 1
|
||||
|
||||
return total_emails, cold_lead_count, no_promotion_count, disqualified_lead_count
|
||||
return (total_emails, cold_lead_count, no_promotion_count, disqualified_lead_count,
|
||||
english_cold_lead_count, chinese_cold_lead_count)
|
||||
|
||||
|
||||
|
||||
@app.route('/customer/<int:index>')
|
||||
|
|
@ -216,7 +226,9 @@ def view_customer(index):
|
|||
is_last = index == len(customer_data) - 1
|
||||
|
||||
# 调用统计函数,获取统计数据
|
||||
total_emails, cold_lead_count, no_promotion_count, disqualified_lead_count = calculate_statistics()
|
||||
# Call the statistics function
|
||||
(total_emails, cold_lead_count, no_promotion_count, disqualified_lead_count,
|
||||
english_cold_lead_count, chinese_cold_lead_count) = calculate_statistics()
|
||||
|
||||
# Call new function to count companies
|
||||
company_count = count_companies()
|
||||
|
|
@ -230,6 +242,8 @@ def view_customer(index):
|
|||
cold_lead_count=cold_lead_count,
|
||||
no_promotion_count=no_promotion_count,
|
||||
disqualified_lead_count=disqualified_lead_count,
|
||||
english_cold_lead_count=english_cold_lead_count,
|
||||
chinese_cold_lead_count=chinese_cold_lead_count,
|
||||
company_count=company_count)
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -84,7 +84,9 @@
|
|||
|
||||
<!-- Fixed status bar -->
|
||||
<div class="status-bar">
|
||||
<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>
|
||||
<p>Total Emails: {{ total_emails }} | Cold Leads: {{ cold_lead_count }} | No Promotion: {{ no_promotion_count }} |
|
||||
Disqualified Leads: {{ disqualified_lead_count }} | Total Companies: {{ company_count }} |
|
||||
English Cold Leads: {{ english_cold_lead_count }} | Chinese Cold Leads: {{ chinese_cold_lead_count }}</p>
|
||||
</div>
|
||||
|
||||
<!-- JavaScript for navigation functions -->
|
||||
|
|
|
|||
Loading…
Reference in New Issue