Template:Category/Schedule step/row

From Miniscope
Jump to: navigation, search

Row renderer for Template:Category/Schedule step and Template:Category/Submission/timeline. Do not transclude directly.

SMW's format=template calls this template once per query result. Named-arg params come from the outer #ask:

  • Step — sequence number
  • Offset — numeric offset in days (may be empty)
  • When — human-readable offset description
  • Action — action description
  • Audience — target audience
  • Condition — condition under which the step applies

Deadline discovery: This template looks up Has submission deadline on Template:Category/Schedule step/row — which resolves to the page currently being rendered (e.g. a Category:Submission page), not the template page. This avoids relying on SMW's userparam mechanism, which is not honored consistently across SMW versions.

Rendering:

  • On a page with Has submission deadline set
 (a Submission page) and a numeric Offset, renders the
 computed date (deadline + Offset days) plus a
 parenthetical countdown and a Status bucket ("done", "▶ now", "soon",
 or "future").
  • On such a page but with no numeric offset (early-process steps),
 renders em-dashes.
  • On a page without Has submission deadline
 (e.g. a Schedule template page), renders the raw offset as "-10 days"
 in the Date column and an em-dash in the Status column.

Date arithmetic uses Unix timestamps to sidestep sign/format ambiguity in date strings: the deadline is parsed to a timestamp, the offset is added as seconds, and the result is formatted back to Y-m-d.