fix(access): expose master data maintenance queue
This commit is contained in:
@@ -132,6 +132,9 @@ func (s *Service) AccessSummary(ctx context.Context, query AccessQuery) (AccessS
|
||||
case "degraded":
|
||||
result.DegradedVehicles++
|
||||
}
|
||||
if len(row.MasterDataIssues) > 0 {
|
||||
result.MasterDataIncompleteVehicles++
|
||||
}
|
||||
switch row.OnlineState {
|
||||
case "online":
|
||||
result.OnlineVehicles++
|
||||
@@ -502,7 +505,11 @@ func keepAccessRow(row AccessVehicleRow, query AccessQuery) bool {
|
||||
return false
|
||||
}
|
||||
if value := strings.TrimSpace(query.ConnectionState); value != "" && value != "all" {
|
||||
if value == "attention" {
|
||||
if value == "master_data" {
|
||||
if len(row.MasterDataIssues) == 0 {
|
||||
return false
|
||||
}
|
||||
} else if value == "attention" {
|
||||
if row.ConnectionState == "healthy" {
|
||||
return false
|
||||
}
|
||||
|
||||
@@ -26,6 +26,9 @@ func TestAccessSummaryUsesDynamicFreshnessAndDelay(t *testing.T) {
|
||||
if summary.HealthyVehicles != 1 || summary.IncompleteVehicles != 0 || summary.DegradedVehicles != 2 {
|
||||
t.Fatalf("connection-state counters must be mutually exclusive: %+v", summary)
|
||||
}
|
||||
if summary.MasterDataIncompleteVehicles != 1 {
|
||||
t.Fatalf("master-data maintenance must be counted independently from connection health: %+v", summary)
|
||||
}
|
||||
}
|
||||
|
||||
func TestAccessVehiclesFiltersAndKeepsEvidenceGapsExplicit(t *testing.T) {
|
||||
@@ -50,6 +53,10 @@ func TestAccessVehiclesFiltersAndKeepsEvidenceGapsExplicit(t *testing.T) {
|
||||
if err != nil || attention.Total != 5 {
|
||||
t.Fatalf("attention filter should return every vehicle requiring attention: page=%+v err=%v", attention, err)
|
||||
}
|
||||
masterData, err := service.AccessVehicles(context.Background(), AccessQuery{ConnectionState: "master_data", Limit: 20})
|
||||
if err != nil || masterData.Total != 1 || len(masterData.Items[0].MasterDataIssues) == 0 {
|
||||
t.Fatalf("master-data queue should include issues regardless of connection state: page=%+v err=%v", masterData, err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestAccessVehiclesSupportsModelProviderAndTimeFilters(t *testing.T) {
|
||||
|
||||
@@ -520,22 +520,23 @@ type AccessDistribution struct {
|
||||
}
|
||||
|
||||
type AccessSummary struct {
|
||||
TotalVehicles int `json:"totalVehicles"`
|
||||
OnlineVehicles int `json:"onlineVehicles"`
|
||||
OfflineVehicles int `json:"offlineVehicles"`
|
||||
LongOfflineVehicles int `json:"longOfflineVehicles"`
|
||||
NeverReported int `json:"neverReported"`
|
||||
UnknownVehicles int `json:"unknownVehicles"`
|
||||
DelayAbnormal int `json:"delayAbnormal"`
|
||||
ReportedToday int `json:"reportedToday"`
|
||||
HealthyVehicles int `json:"healthyVehicles"`
|
||||
IncompleteVehicles int `json:"incompleteVehicles"`
|
||||
DegradedVehicles int `json:"degradedVehicles"`
|
||||
OnlineRate float64 `json:"onlineRate"`
|
||||
Protocols []AccessDistribution `json:"protocols"`
|
||||
OEMs []AccessDistribution `json:"oems"`
|
||||
AsOf string `json:"asOf"`
|
||||
ThresholdVersion int `json:"thresholdVersion"`
|
||||
TotalVehicles int `json:"totalVehicles"`
|
||||
OnlineVehicles int `json:"onlineVehicles"`
|
||||
OfflineVehicles int `json:"offlineVehicles"`
|
||||
LongOfflineVehicles int `json:"longOfflineVehicles"`
|
||||
NeverReported int `json:"neverReported"`
|
||||
UnknownVehicles int `json:"unknownVehicles"`
|
||||
DelayAbnormal int `json:"delayAbnormal"`
|
||||
ReportedToday int `json:"reportedToday"`
|
||||
HealthyVehicles int `json:"healthyVehicles"`
|
||||
IncompleteVehicles int `json:"incompleteVehicles"`
|
||||
DegradedVehicles int `json:"degradedVehicles"`
|
||||
MasterDataIncompleteVehicles int `json:"masterDataIncompleteVehicles"`
|
||||
OnlineRate float64 `json:"onlineRate"`
|
||||
Protocols []AccessDistribution `json:"protocols"`
|
||||
OEMs []AccessDistribution `json:"oems"`
|
||||
AsOf string `json:"asOf"`
|
||||
ThresholdVersion int `json:"thresholdVersion"`
|
||||
}
|
||||
|
||||
type AccessProtocolThreshold struct {
|
||||
|
||||
Reference in New Issue
Block a user