Template talk:Xviews

(Redirected from Template talk:Xviews/summary)
Latest comment: 1 month ago by Mathglot in topic Deprecate ct

List of templates

edit

{{Xreadership}} is the top-level tmbox (talk page message box) destined for the Talk page, and is a temporary replacement for {{annual readership}}. It calls {{xviews}} and {{xviews/summary}}.

Subtemplates of {{Xviews}} include the following:

  • {{xviews/xvmain}}, main loop that calls item bar once for each page view statistic in the file
  • {{xviews/age}}, returns the age in days of the most recent statistic in the given pageviews file
  • {{xviews/item bar}}, emits one progress bar-style graphic corresponding to a given line number of a pageviews file
  • {{xviews/vbar}}, generates a single page views bar, currently horizontal only
  • {{xviews/max views}}, return the maximum value from downloaded pageviews data.
  • {{xviews/min views}}, return the minimum value from downloaded pageviews data.
  • {{xviews/first date}}, return the first (oldest) date in the pageviews file.
  • {{xviews/last date}}, return the last (most recent) date in the pageviews file.
  • {{xviews/view count}}, return the count of page view statistics in downloaded pageviews data
  • {{xviews/nth view}}, returns the nth view item (date:value) from downloaded pageviews data.
  • {{xviews/xlabel}}, returns a normalized form of the date for bar identification; currently, just drops the year.
  • {{xviews/x-axis}}, generates an x-axis legend with labeled tick marks for a horizontal page views chart
  • {{xviews/summary}}, generates a summary string containing six statistics about the pageviews file.
  • {{xviews/pvstatus}}, returns the status of a pageviews file: missing, aging, stale, or empty for good status.

Pseudo-globals:

  • gSTALE ({{xviews/gSTALE}} = 30) – the age in days after which a pageviews file, and any chart based on it, becomes stale and no longer appropriate for display on a Talk page
  • gINTERVAL ({{xviews/gCOUNT}} = 75) – default number of days to display; normally 92 (3 months)
  • gAGING ({{Xviews/gAGING}} = 7) – value after which the pageviews file is listed for update needed

To-do

edit
  • staleness — doesn't belong in Xviews; move to Xreadership instead. Xviews should always display what you ask for. Mathglot (talk) 21:14, 13 September 2024 (UTC)Reply
    •   Partly done – now in Xreadership.
  • constants – better "globals" handling; some constants referred to in more than one place should probably be stub templates that just return the value; e.g., default staleness threshold; days default; days max; ff (to prevent wrapping).
    •   Partly done – max_views, min_views, view_count. May need ff (see x-axis ticks).
  • max view issue – return max of view statistic of displayed bars, not max of all view stats in the file
  • longest bar calc – the current mix of some CSS values denominated in ch and some in % needs improvement.
    • Or, leave bar length alone, but do something else with the max value, like place inside the bar? Or pop up on hover?
  • x-axis tick placement – the calc for placement of ticks needs to be adjusted by the same ff that is used to keep the longest bar from overflowing.
  • view amount display – do something with long values; e.g., 123.4k instead of 123,456; ditto millions. Pop up full value on hover.
  • TemplateStyles – {{Xreadership}} uses in-line style; should it be moved to TemplateStyles? What do other Tmboxes do?
    • Yes, and use class box-Xreadership, per this; t.b.d.
  • upgrades: add support for log values; vertical mode.
  • edit notice-based instructions; in progress at {{Xreadership/New pageviews instructions}}.
  • rename param ct to days to align better with Xreadership, have one less alias, and simplify the doc.
  • mobile – tmbox already suppressed; anything else?

Mathglot (talk) 21:14, 13 September 2024 (UTC)Reply

Some updates interpolated above as indented, unsigned additions. Mathglot (talk) 22:34, 23 September 2024 (UTC) More updates added above without individual sigs. Mathglot (talk) 03:22, 29 September 2024 (UTC) Several more.Mathglot (talk) 19:46, 29 September 2024 (UTC)Reply

Bugs and issues

edit
Talk:Brewing in Oregon

The pageviews file Talk:Brewing in Oregon/pageviews is more than 30 days old; please see Instructions. .

Note: max=32, so bar length is okay; here is Talk:Brewing in Oregon/pageviews. Mathglot (talk) 08:42, 14 September 2024 (UTC)Reply

Robustness enhancement: data title

edit

The download has the pagename in it. When Xviews is launched on the default page, it should read the page title in the download, and if it does not agree with Template:Xviews, an error message should be emitted, and no chart displayed, to guard against a download file being copied to the wrong destination page. Mathglot (talk) 08:51, 15 September 2024 (UTC)Reply

Enhanced summary

edit

For an enhanced summary display, add new subtemplates to extract the first and last dates from pageviews; then we can alter */summary to produce a more informative and user-friendly message, like 'Page views from <start> to <end-date> ...' etc. Mathglot (talk) 22:35, 23 September 2024 (UTC)Reply

Sandbox now has this, but there's an issue about whether param1 should be the page name with, or without, the /pageviews sufffix. Part of the issue is linking the download file from toolforge, which needs the {{SUBJECTPAGENAME}} without the /pageviews suffix, and if param1 is defined with it, then it has to be stripped first, and if it isn't, then either we need another param (ugh!) or we just assume that the pageviews file is always a subpage with the name /pageviews, which hasn't been the assumption so far. Mathglot (talk) 02:31, 25 September 2024 (UTC)Reply

Deprecate ct

edit

I think old param alias |ct= for param 2 (days) has now been removed from the wild, so it can be removed from the code once that has been fully tested. Mathglot (talk) 21:33, 28 September 2024 (UTC)Reply

Done in the wild (check); still persists in some subtemplates, i.e., {{Xviews/xvmain}}. Mathglot (talk) 19:38, 29 September 2024 (UTC)Reply