# Community Stats

*12 August 2026*

A port of the `edstats` IPS app: a block showing what the community adds up to
— members, topics, posts, files, images, entries, events, who is online, who
joined last — with a trend against the same figure a week ago.

Pulse, landed earlier today, answers *who visits*. This answers *what they have
built*. They are the two halves of the same question and neither is the other.

## 🚨 Every stat is conditional on the module that owns it

"Images" is a Gallery number. "Files" is a Downloads number. On a site with
Gallery switched off, an Images figure is not zero — **it does not exist**, and
showing 0 is a lie that makes an empty-looking community out of a working one.

So each stat declares which module it belongs to, and the block renders the
ones that module is installed *and enabled* for. A site running forums alone
gets four figures and no gaps.

This is also why the block cannot be a fixed template. What it contains depends
on the install.

## Trends, and the two stats that must not have one

A trend is today's figure against the same figure seven days ago, from a daily
snapshot. Two stats are explicitly excluded:

- **Online** is a live number. Averaging "how many people are here right now"
  over a day produces something that is not a fact about anything.
- **Newest member** is a name. A name has no trend.

🚨 Getting this wrong is worse than omitting trends entirely, because a
plausible-looking arrow is read as information.

## 🚨 A snapshot is taken once a day, and a missing day is not a zero

The history table holds one row per stat per day. If the scheduler misses a day
— the box was down, the module was disabled — that day has **no row**, and the
trend must span the gap rather than treat it as zero.

The same trap as Pulse's rollup, in a different shape: absent and zero are
different, and code that conflates them destroys the record it exists to keep.

## Cached, because a block renders on every page

Counting rows in five tables on every page view of the site is the obvious
version and the wrong one. The figures are computed at most once every few
minutes and held; the exact interval is a setting, because a busy site and a
quiet one want different answers.

🚨 The cache key includes **who is looking** only where it must. Most of these
are public totals and the same for everybody. "Who is online" is not, and is
the one that has to be careful.

## What it deliberately does not do

**No charts.** The trend is an arrow and a percentage. A sparkline per stat in a
sidebar block is decoration at the size it would be drawn, and Pulse already
draws the chart that is worth drawing.

**No per-forum breakdown.** That is a report, not a block. The admin screen is
for choosing what appears and how often it refreshes, not for analysis.

**No "records" or all-time highs.** A high-water mark that nothing can beat for
two years is a number that stops meaning anything the day after it is set.
