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:
@@ -7,7 +7,7 @@ class DashboardControllerTest < ActionDispatch::IntegrationTest
|
||||
|
||||
assert_response :success
|
||||
assert_match(/Da contattare/, response.body)
|
||||
assert_match(/Conteggio per stage attuale/, response.body)
|
||||
assert_match(/Prospect e clienti sono società/, response.body)
|
||||
assert_match(/da qui in poi/, response.body)
|
||||
assert_match(/In trattativa senza next action/, response.body)
|
||||
assert_match(/Senza attività in timeline/, response.body)
|
||||
|
||||
@@ -82,12 +82,37 @@ class DashboardMetricsTest < ActiveSupport::TestCase
|
||||
assert_equal 0, metrics.demo_to_won_conversion
|
||||
end
|
||||
|
||||
test "customers acquired counts unique organizations not duplicate won deals" do
|
||||
org = Organization.create!(
|
||||
name: "Cliente doppio #{SecureRandom.hex(3)}",
|
||||
status: "prospect",
|
||||
organization_type: "societa_sportiva"
|
||||
)
|
||||
2.times { |i| add_opp("won", organization: org, name: "Deal #{i}") }
|
||||
add_opp("won")
|
||||
|
||||
assert_equal 3, metrics.stage_counts["won"]
|
||||
assert_equal 2, metrics.customers_count
|
||||
end
|
||||
|
||||
test "goal progress" do
|
||||
goal = sales_goals(:september)
|
||||
assert_equal 0, goal.current_value
|
||||
assert_equal 0, goal.progress_percentage
|
||||
end
|
||||
|
||||
test "customers_acquired goal counts distinct organizations in the period" do
|
||||
org = Organization.create!(
|
||||
name: "Cliente goal #{SecureRandom.hex(3)}",
|
||||
status: "prospect",
|
||||
organization_type: "societa_sportiva"
|
||||
)
|
||||
2.times { |i| add_opp("won", organization: org, name: "Goal deal #{i}") }
|
||||
add_opp("won")
|
||||
|
||||
assert_equal 2, sales_goals(:september).current_value
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def metrics
|
||||
@@ -95,7 +120,7 @@ class DashboardMetricsTest < ActiveSupport::TestCase
|
||||
end
|
||||
|
||||
def add_opp(stage, **attrs)
|
||||
org = Organization.create!(
|
||||
org = attrs.delete(:organization) || Organization.create!(
|
||||
name: "Soc #{stage} #{SecureRandom.hex(3)}",
|
||||
status: "prospect",
|
||||
organization_type: "societa_sportiva"
|
||||
|
||||
Reference in New Issue
Block a user