Allinea il conteggio clienti della dashboard alle società, non ai deal vinti.
Neumarkt aveva due opportunità WON e gonfiava banner e card a 3, mentre la lista Solo clienti mostra 2 società. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -37,7 +37,7 @@ class SalesGoal < ApplicationRecord
|
||||
|
||||
case metric
|
||||
when "customers_acquired"
|
||||
opps.won.where(won_at: start_date.beginning_of_day..end_date.end_of_day).count
|
||||
opps.won.where(won_at: start_date.beginning_of_day..end_date.end_of_day).distinct.count(:organization_id)
|
||||
when "won_value"
|
||||
opps.won.where(won_at: start_date.beginning_of_day..end_date.end_of_day).sum(:estimated_value).to_f
|
||||
when "trials"
|
||||
|
||||
@@ -15,6 +15,10 @@ class Dashboard::Metrics
|
||||
organizations_scope.prospects.count
|
||||
end
|
||||
|
||||
def customers_count
|
||||
organizations_scope.customers.count
|
||||
end
|
||||
|
||||
def open_pipeline_value
|
||||
@scope.open_stage.sum(:estimated_value).to_f
|
||||
end
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<p class="mb-3 text-sm text-slate-500">Conteggio per stage attuale: quante opportunità sono in quello stato ora.</p>
|
||||
<p class="mb-3 text-sm text-slate-500">Prospect e clienti sono società. Gli altri numeri sono opportunità nello stage attuale.</p>
|
||||
<div class="grid grid-cols-2 gap-3 md:grid-cols-3 xl:grid-cols-4">
|
||||
<% [
|
||||
["Prospect totali", @metrics.prospect_count],
|
||||
@@ -48,7 +48,7 @@
|
||||
["Demo/Trial", @stage_counts["demo_trial"]],
|
||||
["Primo utilizzo", @stage_counts["first_use"]],
|
||||
["Proposte", @stage_counts["proposal"]],
|
||||
["Clienti acquisiti", @stage_counts["won"]],
|
||||
["Clienti acquisiti", @metrics.customers_count],
|
||||
["Persi", @stage_counts["lost"]],
|
||||
["Valore WON", format_money(@metrics.won_value)],
|
||||
["Pipeline aperta", format_money(@metrics.open_pipeline_value)],
|
||||
|
||||
Reference in New Issue
Block a user