feat: add party-size queueing and call modes
This commit is contained in:
@@ -8,15 +8,15 @@ import (
|
||||
|
||||
type ETAInput struct {
|
||||
PeopleAhead int
|
||||
IntervalPerNumber time.Duration
|
||||
IntervalPerPerson time.Duration
|
||||
Running bool
|
||||
}
|
||||
|
||||
type ETAResult struct {
|
||||
Available bool `json:"available"`
|
||||
EstimateMinutes int `json:"estimate_minutes,omitempty"`
|
||||
MinMinutes int `json:"min_minutes,omitempty"`
|
||||
MaxMinutes int `json:"max_minutes,omitempty"`
|
||||
EstimateMinutes int `json:"estimate_minutes"`
|
||||
MinMinutes int `json:"min_minutes"`
|
||||
MaxMinutes int `json:"max_minutes"`
|
||||
Reason string `json:"reason,omitempty"`
|
||||
}
|
||||
|
||||
@@ -27,10 +27,10 @@ func CalculateETA(input ETAInput) (ETAResult, error) {
|
||||
if input.PeopleAhead < 0 {
|
||||
return ETAResult{}, errors.New("people ahead cannot be negative")
|
||||
}
|
||||
if input.IntervalPerNumber <= 0 {
|
||||
if input.IntervalPerPerson <= 0 {
|
||||
return ETAResult{Available: false, Reason: "missing_interval_configuration"}, nil
|
||||
}
|
||||
rawMinutes := float64(input.PeopleAhead+1) * input.IntervalPerNumber.Minutes()
|
||||
rawMinutes := float64(input.PeopleAhead) * input.IntervalPerPerson.Minutes()
|
||||
estimate := roundUpFive(rawMinutes)
|
||||
return ETAResult{
|
||||
Available: true,
|
||||
|
||||
Reference in New Issue
Block a user