This commit is contained in:
hailin 2024-10-29 11:24:16 +08:00
parent d42004ac9c
commit 32680e29b9
2 changed files with 12 additions and 4 deletions

14
app.py
View File

@ -158,7 +158,12 @@ def index():
# New function to count the number of companies
def count_companies():
company_count = 0
for customer in customer_data:
company_count += len(customer) # Each domain in the customer dictionary represents a company
return company_count
def calculate_statistics():
@ -209,6 +214,9 @@ def view_customer(index):
# 调用统计函数,获取统计数据
total_emails, cold_lead_count, no_promotion_count = calculate_statistics()
# Call new function to count companies
company_count = count_companies()
return render_template('edit_customers.html',
customer=customer,
index=index,
@ -216,8 +224,8 @@ def view_customer(index):
is_last=is_last,
total_emails=total_emails,
cold_lead_count=cold_lead_count,
no_promotion_count=no_promotion_count)
no_promotion_count=no_promotion_count,
company_count=company_count)
@app.route('/update/<int:index>', methods=['POST'])

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 }}</p>
<p>Total Emails: {{ total_emails }} | Cold Leads: {{ cold_lead_count }} | No Promotion: {{ no_promotion_count }} | Total Companies: {{ company_count }}</p>
</div>
<!-- JavaScript for navigation functions -->