diff --git a/app.py b/app.py index cbaa57a..ffd8f14 100644 --- a/app.py +++ b/app.py @@ -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/', methods=['POST']) diff --git a/templates/edit_customers.html b/templates/edit_customers.html index a4d55cc..549bb16 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 Emails: {{ total_emails }} | Cold Leads: {{ cold_lead_count }} | No Promotion: {{ no_promotion_count }} | Total Companies: {{ company_count }}