mirror of
https://github.com/andwati/telecom-platform.git
synced 2026-11-04 19:02:19 +00:00
- Move calculateElasticity, calculateCompetitiveIndex, and calculateOptimizationROI to optimization_opt_service.go - Move generateAnalysis, calculateConfidence, and calculateChurnRate to optimization_opt_service.go - Simplify calculatePriceElasticity by removing comments and consolidating logic - Simplify optimizeForRevenue, optimizeForMarketShare, optimizeForProfitMargin, optimizeForCompetitive, and optimizeForChurn
28 lines
587 B
Go
28 lines
587 B
Go
package pricing
|
|
|
|
import (
|
|
"time"
|
|
)
|
|
|
|
// getPeriodStart returns start date for period
|
|
func (s *PricingOptimizationService) getPeriodStart(period string) time.Time {
|
|
now := time.Now()
|
|
switch period {
|
|
case "daily":
|
|
return now.Truncate(24 * time.Hour)
|
|
case "weekly":
|
|
return now.AddDate(0, 0, -7)
|
|
case "monthly":
|
|
return now.AddDate(0, -1, 0)
|
|
case "quarterly":
|
|
return now.AddDate(0, -3, 0)
|
|
default:
|
|
return now.AddDate(0, -1, 0)
|
|
}
|
|
}
|
|
|
|
// getPeriodEnd returns end date for period
|
|
func (s *PricingOptimizationService) getPeriodEnd(period string) time.Time {
|
|
return time.Now()
|
|
}
|