Skip to content

fix(sleep): resolve displayed efficiency from the selected night - #2944

Open
ssthormess wants to merge 2 commits into
ryanbr:mainfrom
ssthormess:fix/2930-sleep-efficiency-resolver
Open

ssthormess wants to merge 2 commits into
ryanbr:mainfrom
ssthormess:fix/2930-sleep-efficiency-resolver

Conversation

@ssthormess

@ssthormess ssthormess commented Nov 25, 2026 •

Copy link
Copy Markdown

What this PR does

The Stage Breakdown could show a stored session efficiency while Night detail showed the latest daily value. Both platforms now resolve the displayed night's efficiency in one pure helper: session value, matching daily row, then asleep / time in bed. Fraction and percentage inputs retain the existing normalization.

Apple passes the carousel night to Night detail and uses its local wake-day row instead of repo.today. Android shares the resolved text across the hero, breakdown and tile, including the no-day-model fallback; a historical model used to keep the grid visible cannot supply another night's efficiency. The sparkline and typical caption remain on the daily series. No stored metrics or design tokens change.

Type of change

  • Bug fix

How it was tested

  • swiftc -O Strand/Screens/NightEfficiency.swift /home/ploi/noop-2930-oracle/main.swift -o /home/ploi/noop-2930-oracle/check && /home/ploi/noop-2930-oracle/check: 11 cases passed; stdout pinned verbatim in NightEfficiencyTest.swiftOracle. Covers session precedence, fraction/percent inputs, missing values, non-positive time in bed and the ratio cap.
  • StrandTests/NightEfficiencyTests.swift adds the same cases and selected-night/day lookup assertions. Android tests also cover selected-night session precedence, unchanged daily history and the hero's no-day-row fallback.
  • python3 Tools/doc_comment_lint.py: passed.
  • cd android && ./gradlew testFullDebugUnitTest --no-build-cache --rerun-tasks: running after first-time Gradle/dependency setup; result to follow.
  • python3 Tools/i18n_audit.py --ci upstream/main: passed.
  • python3 -m unittest discover -s Tools -p 'test_*.py': running; result to follow.

Upstream status: all five applicable workflows are action_required pending fork approval; no checks have run.

Linux cannot run the macOS/iOS app builds or StrandTests; those need the Apple CI legs. XcodeGen is unavailable here, so project regeneration is left to CI. No UI or on-device verification was performed.

Checklist

  • Swift package tests pass for any package touched (no package changes)
  • Android unit tests pass
  • No new build warnings introduced (app checks pending)
  • UI changes use only existing design tokens; no colors, fonts or spacing changed
  • No hardcoded hex frame bytes
  • Follows docs/CONTRIBUTING.md
  • No generated output or secrets committed

Related issues

Refs #2930.

n1c pushed a commit to n1c/noop that referenced this pull request Nov 26, 2026
…cy from the selected night

ryanbr#2944

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CZyrZuBf2575a3s8MZTqNZ
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant