bocoup / bots

Our bots.
8 stars 8 forks source link

metrics update #148

Closed tkellen closed 8 years ago

tkellen commented 8 years ago

WIP

cowboy commented 8 years ago

FWIW, I tried this code, but slack renders \u2588 and \u258c at different heights, so it looks horrible 👎

export function histogramByPercentage(width, percentage) {
  const pct = Math.floor(percentage * 100);
  const base = FILLED.repeat(Math.floor(pct / 100 * width));
  const extra = pct === 0 ? '' : pct === 100 || pct % width >= 5 ? FILLED : HALF;
  const filled = base + extra;
  const empty = EMPTY.repeat(width - filled.length + 1);
  return `${filled}${empty}${pct}%`;
}

Still, here it is, in case we can find a way to work around it.

cowboy commented 8 years ago

The SQL is way out of my league, so I didn't try to review it. And I made a few formatting tweaks. Other than my remaining comments, 👍

tkellen commented 8 years ago

thanks @cowboy!