// This function selects the billing model that should be used
// It represents some requirement to always use the same standard billing models
// This function should not exist but it does represents some requirement that we cannot do on backend
This function selects the billing model that should be used
It represents some requirement to always use the same standard billing models
This function should not exist but it does represents some requirement that we cannot do on backend
// This function selects the billing model that should be used // It represents some requirement to always use the same standard billing models // This function should not exist but it does represents some requirement that we cannot do on backend
func BattleOfInstanceBillingModels(quotas []QuotaSpec) []QuotaSpec {
	var betterQuotasMap map[string]*QuotaSpec = make(map[string]*QuotaSpec)
	alwaysWinsBillingModel := "standard"
	for i := 0; i < len(quotas); i++ {
		if quotas[i].BillingModel == alwaysWinsBillingModel {
			betterQuotasMap[quotas[i].Name] = &quotas[i]
		} else if betterQuotasMap[quotas[i].Name] == nil {
			betterQuotasMap[quotas[i].Name] = &quotas[i]
		}
	}
	var betterQuotas []QuotaSpec
	for _, v := range betterQuotasMap {
		betterQuotas = append(betterQuotas, *v)
	}
	return betterQuotas
}
func BattleOfInstanceBillingModels ( quotas [ ] QuotaSpec ) [ ] QuotaSpec { var betterQuotasMap map [ string ] * QuotaSpec = make ( map [ string ] * QuotaSpec ) alwaysWinsBillingModel := " " for i := 0 ; i < len ( quotas ) ; i ++ { if quotas [ i ] . BillingModel == alwaysWinsBillingModel { betterQuotasMap [ quotas [ i ] . Name ] = & quotas [ i ] } else if betterQuotasMap [ quotas [ i ] . Name ] == nil { betterQuotasMap [ quotas [ i ] . Name ] = & quotas [ i ] } } var betterQuotas [ ] QuotaSpec for _ , v := range betterQuotasMap { betterQuotas = append ( betterQuotas , * v ) } return betterQuotas }
This function selects the billing model that should be used
It represents some requirement to always use the same standard billing models
This function should not exist but it does represents some requirement that we cannot do on backend
This function selects the billing model that should be used It represents some requirement to always use the same standard billing models This function should not exist but it does represents some requirement that we cannot do on backend