feat: add party-size queueing and call modes

This commit is contained in:
wangxuming
2026-07-16 11:40:34 +08:00
parent 7f751bebae
commit 66951b4dc3
53 changed files with 3348 additions and 533 deletions

View File

@@ -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,