Skip to content

Fix session editing bugs#6

Merged
JanJetze merged 3 commits intomasterfrom
fix/session-editing-bugs
Mar 6, 2026
Merged

Fix session editing bugs#6
JanJetze merged 3 commits intomasterfrom
fix/session-editing-bugs

Conversation

@JanJetze
Copy link
Copy Markdown
Owner

@JanJetze JanJetze commented Mar 6, 2026

Summary

  • Fix duplicate saves: saveSessionOverride now accepts existingOverrideId and calls update() for existing overrides instead of always insert()
  • Fix test data leak: Override date keys are prefixed with "test:" in test mode so they don't appear in real data mode
  • Simplify editing UX: Remove intermediate ActivityOverrideSheet and override badge; tapping a session opens SessionEditSheet directly
  • Add new activity creation: FAB button creates a new manual activity (defaults to Walking, noon, 30min)
  • STILL overrides suppress sessions: mergeSessionOverrides filters STILL overrides from results instead of showing them
  • Delete for all sessions: Detected sessions get a STILL override on delete; manual overrides get deleted directly

Test plan

  • Edit session type (Walking→Cycling) and verify save works
  • Re-edit same session and verify update (no duplicate created)
  • Create new activity via FAB and verify it appears
  • Delete manual activity and verify removal
  • Create test mode override, switch to real data, verify no leak
  • Unit tests pass for mergeSessionOverrides including STILL suppression

🤖 Generated with Claude Code

JanJetze and others added 3 commits March 6, 2026 22:05
…anup

Fix save creating duplicates by passing existingOverrideId to update instead
of always inserting. Isolate test data overrides with "test:" date key prefix.
Simplify editing flow by removing intermediate ActivityOverrideSheet and
override badge. Add FAB for creating new activities. STILL overrides now
suppress sessions without appearing in results. Add delete button for all
sessions.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ndows

Override and manually created sessions now get their stepCount computed
from sensor windows that fall within their time range, matching the
behavior of detected sessions.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Extract shared step counting to `sumStepsInRange()` extension on
  `List<SensorWindow>`, used by both RecomputeActivitySessionsUseCase
  and MergeSessionOverridesUseCase
- Add `isNew` property and `effectiveEndTime()` to ActivitySession,
  removing magic `startTransitionId == 0` checks and repeated
  `endTime ?: (startTime + 30 * 60_000L)` fallbacks
- Deduplicate ViewModel's two `combine` blocks into a single block
  with conditional session/window flows
- Remove `_useTestData` MutableStateFlow mutation inside reactive
  pipeline; read preference directly in `saveSessionOverride`
- Move duplicate `regionColor()` extension to `ActivityColors.colorFor()`
- Use shared `activityLabel()` in SessionEditSheet instead of inline when
- Extract `closeEditSheet` lambda in ActivitiesScreen
- Add tests: sumStepsInRange boundaries, window edge cases, overlapping
  overrides, step count preservation, isNew, effectiveEndTime

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@JanJetze JanJetze merged commit 129233a into master Mar 6, 2026
1 check passed
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