fix: align business pages and detail drawers with prototype
This commit is contained in:
@@ -172,7 +172,7 @@ func TestPerformanceRateSortKeepsUndefinedRatesLast(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestPerformanceMatrixTotalsFollowDisplayedMemberUnion(t *testing.T) {
|
||||
func TestPerformanceMatrixTotalsKeepVisibleScopeWhenRowsAreFiltered(t *testing.T) {
|
||||
_, uc, _, teams, _ := managementFixture()
|
||||
teams.catalog.Groups[0].MemberIDs = []uint{8, 9, 10}
|
||||
ctx := accountContext(7, 901)
|
||||
@@ -181,17 +181,44 @@ func TestPerformanceMatrixTotalsFollowDisplayedMemberUnion(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if len(page.Rows) != 1 || page.MatrixTotal.Open != 1 || page.MatrixTotal.Effective != 1 || page.MatrixTotal.Pay != "9007199254740993.03" || page.Groups[0].UniqueTotal != page.MatrixTotal {
|
||||
t.Fatalf("filtered member union/subtotal mismatch: %+v", page)
|
||||
if len(page.Rows) != 1 || page.MatrixTotal != page.Total || page.MatrixTotal.Open != 2 || page.Groups[0].UniqueTotal.Open != 1 {
|
||||
t.Fatalf("matrix total must retain the full visible scope, with a filtered group subtotal: %+v", page)
|
||||
}
|
||||
if page.Total.Open != 2 || page.Groups[0].Total.Open != 3 {
|
||||
t.Fatal("scope cards and team contributions must retain their own scope")
|
||||
}
|
||||
f.Name, f.GroupID = "", func() *uint64 { id := uint64(999); return &id }()
|
||||
page, err = uc.Query(ctx, f)
|
||||
if err != nil || len(page.Rows) != 0 || page.MatrixTotal.Open != 0 || page.MatrixTotal.Pay != "0.00" || page.Total.Open != 2 {
|
||||
t.Fatalf("empty matrix must have zero totals without changing scope cards: %+v %v", page, err)
|
||||
if err != nil || len(page.Rows) != 0 || page.MatrixTotal != page.Total || page.Total.Open != 2 {
|
||||
t.Fatalf("empty displayed rows must not erase visible-scope totals: %+v %v", page, err)
|
||||
}
|
||||
for period, total := range page.Trend {
|
||||
if page.MatrixTrend[period] != total {
|
||||
t.Fatalf("period total changed with filtering: %s", period)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestBusinessManagementIncludesCurrentGoalWithoutCurrentPerformance(t *testing.T) {
|
||||
_, uc, _, _, _ := managementFixture()
|
||||
amount := int64(2000000)
|
||||
uc.goals.(*managementGoalFake).values = []*PerformanceGoal{{Kind: "person", TargetID: 9, Month: "2026-11", Amount: &amount}}
|
||||
page, err := uc.Query(accountContext(7, 901), PerformanceFilter{ForManagement: true})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if page.End != "2026-10-31" {
|
||||
t.Fatal("business performance must still stop at the last completed month")
|
||||
}
|
||||
for _, row := range page.Rows {
|
||||
if row.Member.ID == 9 {
|
||||
if goal := row.Goals["2026-11"]; goal == nil || goal.Amount == nil || *goal.Amount != amount {
|
||||
t.Fatal("the business list must include this month's configured goal")
|
||||
}
|
||||
return
|
||||
}
|
||||
}
|
||||
t.Fatal("visible member was lost")
|
||||
}
|
||||
|
||||
func TestPerformanceDetailSelectionPreservesContributionsAndScope(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user