Commit 0c7147a
committed
Adaptive-precision fmtPct so small miners don't render as 0.00%
toFixed(2) on share_of_pool_pct hid legitimate small contributors:
a 875 KH/s rig next to a 2 TH/s ASIC is 0.000044% of the pool —
'0.00%' looked like the row was broken. The new fmtPct picks a
decimal count from the magnitude so every non-zero contributor gets
a non-zero display:
>= 1% -> 2 decimals
>= 0.01% -> 3 decimals
>= 0.0001% -> 4 decimals
else -> 2 sig figs
== 0 -> '0%'
null / NaN -> '—'
Exported as stats.fmtPct; passed to both index.ejs (pool
leaderboards) and worker.ejs (per-worker page) via server.js.
Existing per-share reject-rate % on index.ejs still uses toFixed(2)
because reject rates aren't as sensitive to display precision;
leaving that alone to keep the diff small.
Live spot-check confirms the fix: rig1 (875 KH/s next to testrig's
2 TH/s, share of pool ~4.4e-5%) renders as '0.000044%' instead of
'0.00%'.1 parent f1cb7de commit 0c7147a
3 files changed
Lines changed: 29 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
407 | 407 | | |
408 | 408 | | |
409 | 409 | | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
| 45 | + | |
45 | 46 | | |
46 | 47 | | |
47 | 48 | | |
48 | 49 | | |
49 | 50 | | |
50 | 51 | | |
51 | | - | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
52 | 57 | | |
53 | 58 | | |
54 | 59 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
143 | 143 | | |
144 | 144 | | |
145 | 145 | | |
146 | | - | |
| 146 | + | |
147 | 147 | | |
148 | 148 | | |
149 | 149 | | |
| |||
170 | 170 | | |
171 | 171 | | |
172 | 172 | | |
173 | | - | |
| 173 | + | |
174 | 174 | | |
175 | 175 | | |
176 | 176 | | |
| |||
0 commit comments