yapechan on Discord (#feedback, 11-07, WorkBuddy China): the card's
"Credits used per day" read 今天 0 for 积分 and 额外积分 and 今天 34.06
for 积分合计, so the total wasn't the two pools' sum.
Since the plugin's 0.2.22/0.2.24 the card has both pools set aside,
Credits and Extra credits, and Total credits, the two together, as the
window that stops the account. noteDailyCredits takes a window set aside
for a counted window's breakdown when that window used at least as much
over the same span (the CodeArts rule, ec3111d87), and the total always
does, so both pools were marked Part and counted nothing; they still
showed because they had days from before 0.2.22. The card's figures
themselves (x / 500, y / 2900, x+y / 3400) were right; only the days were.
Now pools set aside that together grant what a counted window grants
(poolsOfWhole: two or more, same unit, limits summing to its limit) are
that whole's pools: each counts its own days beside the whole's, and is
shown even with none. A bucket that is only part of its whole (CodeArts'
基础积分 under 总积分) stays its breakdown. Both WorkBuddy builds send the
same shape, so workbuddy-ai is covered too. Days already counted can't be
split again: today's 34.06 stays on the total alone.
TestDailyCreditsPoolsOfWhole (new): the plugin's current card for
CN_FREE_SUMMARY's shape, the extra credits moving alone, then the plan's,
then both: Credits 20 + Extra credits 28 = Total credits 48; and a
CodeArts-like card with two buckets that don't make up its whole shows
总积分 alone.
Run at this head (origin/main 8e350155b) on mote: gofmt -l clean;
go test -count=1 ./internal/provider ok (115s); GOOS=linux and
GOOS=windows go vet -tags nogui ./internal/provider ok.
Broken by hand: the old credits_daily.go makes the new test red (Total
credits 48 alone); dropping the sum check makes its CodeArts half red
(基础积分 shown).
Not tried: yapechan's own readings or a real China account with extra
credits (the desktop's sign-in on this Mac gets 401 from the meter); no
GUI change, so no GUI run.
Reported-by: yapechan