provider: ZCode's check-in is asked again every 30 minutes, as Qoder's is (plugins#503)
ZCode's gift plans open as campaigns, some for under a day (the reporter's ran to 14:00 Beijing). With the check-in settled for the day after a done or inactive answer from noon on, a plan opening in the afternoon could be missed until it had closed. pluginRechecks now includes zcode, so the loop asks again 30 minutes after each answer. Run on mote: go test ./internal/provider/ ok (91s), go vet ok, gofmt clean. Broken by hand: without zcode in pluginRechecks, 4 zcode subtests of TestPluginCheckinQoderRechecksCampaigns are red. Not tried: a real ZCode account with a plan to claim (none open now).
This commit is contained in:
@@ -2,7 +2,8 @@ package provider
|
||||
|
||||
// A daily check-in, whichever vendor's: WorkBuddy's (workbuddy_checkin.go)
|
||||
// and Trae CN's (trae_checkin.go). Each account in use is checked in once
|
||||
// a Beijing day, except Qoder's campaigns, rechecked every 30 minutes,
|
||||
// a Beijing day, except Qoder's campaigns and ZCode's gift plans,
|
||||
// rechecked every 30 minutes,
|
||||
// and an answer that may be the vendor's day before (provisional, #3326),
|
||||
// asked again every 30 minutes until a claim or an answer from noon on.
|
||||
// A press asks the vendor again for a done, inactive or ineligible one.
|
||||
|
||||
@@ -268,9 +268,10 @@ func PluginCheckinOn(s settings.Settings, id string) bool {
|
||||
// within the Beijing day, as magpie's own Qoder check-in is (recheck):
|
||||
// a campaign can open mid-day (Qoder CN's ran 10:00 to 09:59 the next
|
||||
// day), so a done or inactive read before then said nothing about the
|
||||
// day's own and was kept all day, a press too (#2696). Every other
|
||||
// plugin is settled for the day.
|
||||
func pluginRechecks(id string) bool { return id == "qoder" || id == QoderCNID }
|
||||
// day's own and was kept all day, a press too (#2696). ZCode's gift
|
||||
// plans open as campaigns too, some for under a day (plugins#503). Every
|
||||
// other plugin is settled for the day.
|
||||
func pluginRechecks(id string) bool { return id == "qoder" || id == QoderCNID || id == "zcode" }
|
||||
|
||||
func (p pluginCheckinProvider) checkiner(now func() time.Time) checkiner {
|
||||
return checkiner{path: pluginCheckinPath(), now: now, mu: &pluginCheckinMu, by: pluginCheckinBy(p.ID), label: p.ID, recheck: pluginRechecks(p.ID), accounts: func() []checkinAcct {
|
||||
|
||||
@@ -498,9 +498,10 @@ func pluginCheckinCounter(id string, outcome *string, calls *int) pluginCheckinP
|
||||
// magpie's own Qoder check-in is. A campaign can open mid-day, so a done or
|
||||
// inactive read before it was kept for the whole Beijing day, even on a
|
||||
// press. Now the loop asks again 30 minutes after the last answer, not
|
||||
// before, and a press asks at once.
|
||||
// before, and a press asks at once. ZCode's gift plans are rechecked the
|
||||
// same way (plugins#503).
|
||||
func TestPluginCheckinQoderRechecksCampaigns(t *testing.T) {
|
||||
for _, id := range []string{"qoder", QoderCNID} {
|
||||
for _, id := range []string{"qoder", QoderCNID, "zcode"} {
|
||||
for _, first := range []string{CheckinInactive, CheckinDone} {
|
||||
// each: wait this long, press or not, then the outcome shown
|
||||
// and the asks so far
|
||||
@@ -546,7 +547,7 @@ func TestPluginCheckinQoderRechecksCampaigns(t *testing.T) {
|
||||
|
||||
// Every other plugin's check-in is settled for the Beijing day by a claim,
|
||||
// or by a done, inactive or ineligible answered from noon Beijing on: the
|
||||
// loop doesn't ask again after 30 minutes (#2696 changes Qoder's alone).
|
||||
// loop doesn't ask again after 30 minutes (#2696 changes Qoder's, plugins#503 ZCode's).
|
||||
// A press asks again for any of those but a claim: the record is not the
|
||||
// vendor's answer now (#3326).
|
||||
func TestPluginCheckinOthersSettledForTheDay(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user