router: let a habit question outrank the day plan, and know the weekend
IsDayPlanQuery fires on the token "планы" and its other-day list does not know weekday names, so "какие у меня обычно планы по вторникам?" was claimed by the day plan, which answered today's calendar stamped with today's date. The habit source never ran. The matcher now declines any utterance ParseHabitQuery claims, which keeps the decision out of the source table's ordering. Two gaps in the same matcher. Sunday had only its dative plural listed, so "в воскресенье" found no weekday. "по выходным" named days that no weekday word matches, so it was answered with the whole-week profile. Both are recognised now, and the weekend is read back as two days rather than pooled. Found in review of #59.
This commit is contained in:
@@ -350,3 +350,20 @@ func TestPluralDaysRU(t *testing.T) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// "по выходным" is a question about two days, answered as two days.
|
||||
func TestFormatWeekendRU(t *testing.T) {
|
||||
now := behaviorNow()
|
||||
obs := append(
|
||||
habitHistory("workout", time.Saturday, 11, 0, 3, now),
|
||||
habitHistory("walk", time.Sunday, 15, 0, 3, now)...,
|
||||
)
|
||||
got := BuildProfile(obs, now).FormatWeekendRU()
|
||||
if !strings.Contains(got, "по субботам") || !strings.Contains(got, "по воскресеньям") {
|
||||
t.Errorf("got %q, want both weekend days named", got)
|
||||
}
|
||||
empty := BuildProfile(nil, now).FormatWeekendRU()
|
||||
if strings.Contains(empty, "у меня") {
|
||||
t.Errorf("got %q", empty)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user