dialogue, tasks: carry the list she just read (V-448)
Session.Candidates holds what she offered, in the order she offered it, and SetCandidates attaches it in place so the turn already remembered keeps its slots. tasks.Spoken is the list FormatRU actually named, so an ordinal and the spoken order cannot drift apart.
This commit is contained in:
@@ -268,3 +268,26 @@ func pluralTasksRU(n int) string {
|
||||
}
|
||||
return "задач"
|
||||
}
|
||||
|
||||
// Spoken — the tasks FormatRU actually named, in the order it named them
|
||||
// (Vikunja #448). "второй" has to mean the second thing she said, so the list
|
||||
// an ordinal resolves against is built here and not by a caller guessing how
|
||||
// the renderer split and truncated it.
|
||||
func Spoken(ranked []Ranked) []Ranked {
|
||||
var open, cands []Ranked
|
||||
for _, r := range ranked {
|
||||
if r.Status == StatusCandidate {
|
||||
cands = append(cands, r)
|
||||
} else {
|
||||
open = append(open, r)
|
||||
}
|
||||
}
|
||||
out := make([]Ranked, 0, 2*SpokenLimit)
|
||||
for _, group := range [][]Ranked{open, cands} {
|
||||
if len(group) > SpokenLimit {
|
||||
group = group[:SpokenLimit]
|
||||
}
|
||||
out = append(out, group...)
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user