Under the hood · 04

Set quality, baselines and badges

How Logex scores a session against your own history: the baseline it picks, the set and exercise quality formulas, the 14 positive-only badges and their thresholds, plateau-aware badges and badge latching.

9 min read

  • baselines
  • quality score
  • badges
  • PRs
  • plateaus

Most workout apps grade you against everyone. Logex grades you against you. Two engines do this: the quality score, which says how today compares with your usual, and the badges, which recognise specific, data-backed wins.

In plain terms. Today’s best sets are compared with your best-known e1RM. Near your best is a good score. A lighter session simply gets no badge. You never get a red mark. Badges are earned only from the weights and reps you logged, so typing a high RPE can never earn one.

Step 1: pick a baseline

A score needs something to be measured against. The code tries these in order and uses the first one available.

  1. Your historical best e1RM for the exercise. It comes from the stored max_estimated_orm, or, if that is missing, from max_weight × (1 + max_reps ÷ 30). If you have had sessions done while fatigued, the best is first converted to a “fresh equivalent” (see Warmups and fatigue), then multiplied by today’s expected-performance multiplier.
  2. A rep-band baseline for the band of the set being scored.
  3. Session-relative: no history at all, so today’s own best set is the reference.
  4. Neutral: a base score of 0.5.

How band baselines are built

After each save, a background job rebuilds per-band baselines for the exercises you trained. For each of the last 6 sessions it takes the sets in each band (Low, Mid, High), computes the stabilised e1RM of those sets (see Estimated 1RM), divides by that session’s fatigue multiplier, and keeps the median across sessions. It stores the median e1RM, the median volume and the number of sessions. The job looks at every set with weight and reps above zero for the band, so set type is not filtered there. For bodyweight and assisted lifts it uses the load actually moved, with that session’s bodyweight.

Band baselines are stored on the phone and pushed to your account afterwards (queued when offline), so scoring never waits for the network. A band with no sets left anywhere in the lift’s history (for example after you moved those sets to another exercise) is cleared rather than left to grade the next session; a band that is merely missing from the last 6 sessions keeps its baseline.

A three-session minimum

At save time, if you have fewer than three earlier sessions of the exercise, the quality score and the stabilised session e1RM are saved as empty. The badge engine mirrors this: with a known session count below 3, the Quality, PR and every PR-gated badge stay off. Until there is something to compare with, there is no verdict. (A helper that maps 3 to 7 sessions onto a 0.6 to 1.0 confidence and the labels Early Signal, Stable and High Confidence exists in the code, but no screen reads it at release head.)

Step 2: the set quality score

Each eligible set (Working, Volume, AMRAP or 1RM) gets a score from 0 to 1.

ratio       = setE1RM ÷ baselineE1RM
baseScore   = clamp01(0.85 + (ratio − 1) × 3)
stimulus    = clamp01(ln(1 + reps) ÷ ln(13))
effort      = clamp((RPE − 7.5) ÷ 10, −0.10, +0.10)        (0 if no RPE)
setQuality  = clamp01(0.85 × baseScore + 0.15 × stimulus + effort)

The curve is deliberately forgiving: matching your best scores 0.85, not 0.5.

Set e1RM as a share of baseline 105%+ 100% 97% 93% 90% 85% 80%
baseScore 1.00 0.85 0.76 0.64 0.55 0.40 0.25

If there is no baseline the formulas change. With only today’s session to go on, baseScore = clamp01(0.7 + (setE1RM ÷ sessionMaxE1RM − 0.9) × 1.5). With nothing at all, baseScore = 0.5.

Step 3: the exercise quality score

With a real baseline, the session is judged by its top set, with a small capped bonus for backing it up.

exerciseQuality = clamp01(topSetQuality + min(0.06, 0.02 × supportingSets))
supportingSets  = other eligible sets with e1RM ≥ 85% of today's top set

Ramp-up sets and fatigued back-offs fall below that 85% line and are ignored, so they cannot drag a good top set down. Adding light sets cannot inflate the score either, because they do not clear the line.

With no baseline (your first sessions), the score is the volume-weighted mean of set quality plus a volume bias of min(0.12, (sets − 1) × 0.03).

Score Label Badge?
0.85 and up Peak Session Yes
0.68 to 0.85 Solid Work Yes
0.50 to 0.68 Below Peak History only
Below 0.50 Light Session History only

Worked example

Your best bench e1RM is 250. Today: 135 × 8 (Warmup), then 215 × 5, 215 × 5 and 205 × 5, all at RPE 8.

  • The warm-up is not eligible and is ignored.
  • Top set: 215 × 5 gives e1RM 250.8, ratio 1.0033, so baseScore = 0.85 + 0.0033 × 3 = 0.860.
  • stimulus = ln(6) ÷ ln(13) = 0.698. effort = (8 − 7.5) ÷ 10 = 0.05.
  • topSetQuality = 0.85 × 0.860 + 0.15 × 0.698 + 0.05 = 0.886.
  • Supporting sets: the bar is 85% of 250.8 = 213.2. The other 215 × 5 (250.8) and 205 × 5 (239.2) both clear it, so bonus = min(0.06, 2 × 0.02) = 0.04.
  • exerciseQuality = 0.886 + 0.04 = 0.926, a Peak Session.

The badges

Design rule: badges are positive-only and data-backed. Every threshold is a named constant in BadgeEvaluationService.js.

Shared gates: “PR-gated” badges need evidence that this is not your first time on the lift and a session count of at least 3. Only eligible sets count (not Warmup, Warmdown or Dropset). While every settled set so far is a support set, a neutral Warming up state shows and every verdict and achievement badge is forced off, so warm-up volume can never light a badge.

Badge Rule Notes
Quality Quality band is Peak or Solid PR-gated. Weaker bands show nothing.
PR Any eligible set’s e1RM is above your historical max e1RM PR-gated. A single (1 rep) that beats your stored best single also counts, even if its e1RM is not above your overall max.
Plateau Breaker A PR, with 3 or more sessions logged since the session that set the previous best Replaces PR. Shows the number of sessions.
Rep PR A set’s weight is above your best at that exact rep count Needs an existing record at that rep count. Hidden if PR.
Volume PR Eligible volume beats every earlier session At least 3 earlier sessions. Warm-ups excluded on both sides.
Best in 6 Weeks Top e1RM is above every session in the last 42 days At least 2 sessions in the window. Hidden if PR.
Ghost PR Same weight and reps as your record, at a lower RPE Both RPEs must exist. Hidden if PR or Rep PR.
Within Reach Top e1RM is at least 97% of your all-time best, but not a PR Shows the percentage, capped at 99%.
Grinder A set at RPE 9.5 or higher that is also at least 92% of your all-time best e1RM RPE alone cannot trigger it.
Progress Volume or best e1RM is above last session’s Not first time. Needs a last-session number above 0.
Comeback Beats the worst of your last 5 sessions by 50 or more in volume, or 5 or more in e1RM
Steady Hand At least 3 eligible sets with weight and rep variation (CV) each at or below 0.08 CV is standard deviation divided by mean.
Balanced Today’s push share of push plus pull volume is within 0.15 of your recent share Push is chest, shoulders and triceps. Pull is back and biceps. Legs and core never qualify.
Lab Rat The first-ever session of the lift Needs positive proof: the lift has no working sets on record and no earlier session.

Plateau-aware badges

Five badges exist because a plateau is not a failure: Plateau Breaker (a PR after a long drought), Best in 6 Weeks, Within Reach, Grinder and Comeback. They reward real progress that an all-time-PR-only system would ignore. Where they compare against past sessions they use the fatigue-adjusted e1RM (raw ÷ multiplier on both sides), so a lift done late in a workout does not look like a regression. PR, Plateau Breaker, Rep PR, Ghost PR and Volume PR stay raw: a record is still a record.

Worked example

History: you have 8 sessions on record. Your best e1RM of 250 was set in your third most recent session, your 6-rep record is 215 lb, and your last three sessions had volumes of 3000 (best e1RM 240), 2900 (238) and 3100 (250). Today you do 225 × 6.

  • e1RM = 225 × 1.2 = 270, above 250, so PR.
  • Two sessions have been logged since the 250 session, so sessions-since-best is 2. Plateau Breaker needs 3, so it stays a plain PR.
  • 225 beats the 215 six-rep record, but Rep PR is hidden when PR is showing.
  • Comeback: worst recent e1RM is 238, and 270 − 238 = 32, which clears the 5 threshold, so Comeback also shows. Progress is on too (270 is above last session’s 240).

Near-miss indicator

While you are still lifting, a small gap indicator tells you how far you are from unlocking Progress. It is a “near miss” when you are under 50 volume or under 5 lb of e1RM short, using the same fatigue-adjusted numbers so it never disagrees with the badge.

Badge latching

Badge evaluation is a pure function of the sets on screen, so adding a lighter back-off set could otherwise make a badge vanish (it lowers a quality average, or changes a variation measure). The latch fixes that:

  • While you only add sets, badges you have already earned stay on.
  • If you edit or delete a logged set, the latch clears and everything is recomputed, so a corrected typo cannot leave a false PR behind.
  • Warming up is a status, not an achievement, so it is never latched.

A related guard stops flicker while you type: a set only counts once weight and reps are both valid and the row is not being edited. Re-focusing an already-logged set freezes its last settled values, so a badge only changes when you commit a new value.

Limits and edge cases

  • Badges persist as you saw them. They are saved with the workout. Saved copies of older negative quality verdicts (“poor” or “low quality”) are filtered out at display time.
  • Lab Rat is stripped at save if the database already holds an earlier session, whatever the screen computed.
  • Display order when several badges show: Plateau Breaker, PR, Rep PR, Volume PR, Best in 6 Weeks, Quality, Ghost PR, Within Reach, Grinder, Progress, then the rest.
  • Everything is local. The history scan and the band baselines both live on the phone, so scores and badges work offline.
  • Bodyweight and assisted lifts are scored on the load actually moved (a share of your bodyweight plus what you added, or minus the assistance), so a pull-up PR or less assistance on the machine can earn badges. Without a bodyweight there is no load to score.
  • Changing the exercise on a saved workout re-scores that session on the new exercise and rebuilds both exercises’ statistics and baselines.

Source

Written from these files in the Logex app (release head). Constants and formulas above are copied from them.

  • services/WorkoutCalculationService.js
  • services/BaselineService.js
  • services/BadgeEvaluationService.js
  • services/workoutService.js
  • utils/badgeLatch.js
  • utils/exerciseSnapshot.js
  • utils/loadModel.js
  • components/badges/BadgeContainer.js
  • docs/QUALITY_AND_BADGE_FORMULAS.md