refactor: Replace time and ID generation helpers with centralized id package utilities

- Replace getCurrentTime() calls with id.GetCurrentTime() in pricing_integration.go and pricing_service.go
- Replace generateRuleID() with id.GenerateRuleID() in pricing rule creation
- Replace generateEventID() with id.GenerateEventID() in tenant middleware
- Remove local helper functions: generateRuleID, getCurrentTime, generateEventID, generateRandomString, getCurrentTimestamp
- Remove unused time package imports
This commit is contained in:
nutcas3
2026-05-02 05:09:12 +03:00
parent ec812835c8
commit b160029e30
7 changed files with 53 additions and 68 deletions
@@ -181,3 +181,19 @@ func (sa *SelectionAlgorithm) PredictPerformance(carrierID string, criteria *Sel
func (sa *SelectionAlgorithm) GetCarrierPerformance(carrierID string) *PerformanceMetrics {
return sa.mlModel.GetCarrierPerformance(carrierID)
}
// getHighestPriorityCarrier returns the carrier with the highest priority
func (sa *SelectionAlgorithm) getHighestPriorityCarrier(carriers []*Carrier) *Carrier {
if len(carriers) == 0 {
return nil
}
highestPriority := carriers[0]
for _, carrier := range carriers {
if carrier.Priority > highestPriority.Priority {
highestPriority = carrier
}
}
return highestPriority
}