Template talk:LatestComicOnDate

Explain xkcd: It's 'cause you're dumb.
Jump to: navigation, search

I'm playing around with a bit of date math to see if we can reduce the sheer size, server-load, and maintenance requirements of the current implementation of LATESTCOMIC. The premise is that Randall posts comics on a regular basis: Monday, Wednesday, and Friday of every week, and that is eminently predictable (as long as Randall keeps to that schedule... there have been exceptions in the past...)

LatestComicOnDate is predictive, but not definitive: it tells you what comic should be latest on a given date, but if nobody has posted it here yet, well, it doesn't know that.

My thoughts are:

  • Improve the year roll-over behavior (right now, this will work until late December 2012.) Quick thoughts are to change the hard-coded base at the start of the expression (the comic number of in the final ISO-8601 week of 2011) with either a #switch for successive years (ongoing maintenance, but only every few years) or some inter-year week math. Right now, I'm leaning toward the former, for simplicity.
  • LATESTCOMIC would then use this template to decide what the latest comic should be, and then make sure it exists. If not, try n-1, n-2, etc for a few (but not more than a couple ;-) of prior numbers... hopefully this site doesn't go all cobwebby on us that we're more than, say, a week behind...

-- IronyChef (talk) 16:29, 11 August 2012 (UTC)

Sounds cool! My question is, how many exceptions has there been to Randall's posting schedule, and what does their distribution look like (mostly in the early days, evenly spread, etc)? In any case we might want to include a "special case" parameter for when these exceptions occur. --Waldir (talk) 17:48, 11 August 2012 (UTC)
Thanks. This template is really just forward-looking, so there's no attempt to address irregularities in the past. But here's how I think it it will play out:
  • If he's late, it's like we're late: #ifexist returns false, and we go back to a prior entry.
  • If he's early, we miss it until the predicted day. We could work around it by always looking for #ifexist n+1 first, but most of the time this will be false.
Of course, all bets are off if Randall changes his schedule; we'd just have to redo the predictive algorithm. -- IronyChef (talk) 21:14, 11 August 2012 (UTC)

Ah, this already exists, good. Now to check the existing pages, we'll need mw:Extension:Variables. --Kronf (talk) 13:29, 7 June 2013 (UTC)