Repository navigation
fix(progression): an imported session is graded on all of its sets - #349
Merged
Merged
Conversation
After a Hevy or CSV import, the first weight the app suggests for a lift can come from the light early sets. A session logged 40/50/60/70/80 x 5 reads as a 60 kg session when the routine asks for 3 sets today, and the next prescription is 62.5. DuarteSantos8#233 grades only the sets the plan asked for, and readSession takes that count from `target`: `(entry && entry.target) || fallback`. The importers write no target, and neither did anything logged before v1.2.2, so for those the count is the exercise's current config, which sessionsFor passes as the fallback. The slice then keeps the first three rows of a session nobody planned as three sets. readSession now slices only when the entry carries its own target. An entry without one is graded on every work set it has, as it was before DuarteSantos8#233. api/coach/core/payload.js keeps its own copy of readSession and gets the same rule, so the Coach's stall count agrees with the app. progression.extra-sets.test.js: the ramp reads 80 (was 60) and the next prescription is 82.5 (was 62.5); both fail on the old progression.js. payload-parity.test.js: an imported session with a short fourth set is a miss on both sides; it fails with either copy reverted. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Owner
|
Merged and released in v1.3.10, thanks @kurktchiev! https://github.com/DuarteSantos8/openGym/releases/tag/v1.3.10 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
After a Hevy or CSV import, the first weight the app suggests for a lift can come from the light early sets. A session logged as 40/50/60/70/80 × 5 reads as a 60 kg session when the routine asks for 3 sets today, and the next prescription is 62.5.
#233 grades only the sets the plan asked for, and
readSessiontakes that count from(entry && entry.target) || fallback. The importers write notarget, and neither did anything logged before v1.2.2. For those entries the count comes from the exercise's current config, whichsessionsForpasses in as the fallback, so the slice keeps the first three rows of a session that was never planned as three sets.readSessionnow slices only when the entry carries its owntarget. An entry without one is graded on every work set, which is how it was read before #233.enough, the goal and the mode still come from the fallback, as before. api/coach/core/payload.js has its own copy ofreadSessionand gets the same one-line rule, so the Coach's stall count keeps agreeing with the app.Tests:
nextPrescriptionafter it is 82.5. On the old progression.js they read 60 and 62.5. The file's 8 tests pass.Overlaps:
plannedline just above this one and merges cleanly with it. This change only decides whether to slice, so Per side on timed holds, rebased on v1.3.9 with the progression fix #322's doubled count for a timed per-side hold still applies to an entry that carries its own target.readSessionand already conflict with main inside it. This change falls inside those same conflicts, so whichever lands second has to keep the entry's owntargetas the only thing that slices. Percentage (wave) progression + SetBlock refactor #168 also conflicts with main in payload.js's copy.readSessionand Fix: Double progression: grade against the top of the range, not the session's aim #301 changesnextPrescription. Neither gains a conflict from this beyond the ones it already has with main.🤖 Generated with Claude Code