Metrics: the first month counted is labelled as the existing customers
With a "Count from" month set, that month's cohort is everyone already paying then, not only those new that month. Both cohort tables now say "existing customers" under it, the help text explains, and both cohort CSVs add an existing_customers column. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -141,6 +141,11 @@ func TestStartMonthAndSuggestion(t *testing.T) {
|
||||
if m.Suggest == nil || m.Suggest.Month != "2025-01" || m.Suggest.Customers != 25 {
|
||||
t.Fatalf("suggestion: %+v", m.Suggest)
|
||||
}
|
||||
for _, co := range m.Cohorts(5, 2) {
|
||||
if co.Existing {
|
||||
t.Errorf("no start month set, yet %s is the existing customers", co.Month)
|
||||
}
|
||||
}
|
||||
if err := SetStartMonth(d, "2025-01"); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@@ -152,7 +157,7 @@ func TestStartMonthAndSuggestion(t *testing.T) {
|
||||
if jan.Month != "2025-01" || jan.New != 0 || jan.Customers != 25 || m.Suggest != nil {
|
||||
t.Errorf("counted from January: %+v", jan)
|
||||
}
|
||||
if cos := m.Cohorts(5, 2); len(cos) != 1 || cos[0].Customers != 25 {
|
||||
if cos := m.Cohorts(5, 2); len(cos) != 1 || cos[0].Customers != 25 || !cos[0].Existing {
|
||||
t.Errorf("the starting base's cohort: %+v", cos)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user