Skip to content

Paginate sleep records and compute weekly/monthly averages via SQL - #7

Merged
felixbrucker merged 2 commits into
mainfrom
paginate-sleep-records-sql-averages-14714767446794302206
Oct 3, 2026
Merged

felixbrucker merged 2 commits into
mainfrom
paginate-sleep-records-sql-averages-14714767446794302206

Conversation

@felixbrucker

Copy link
Copy Markdown
Owner

Paginated sleep records using Room Paging 3, removed total sleep duration and average sleep duration from the UI, and added weekly (last 7 days) and monthly (last 30 days) sleep duration averages calculated directly via Room SQL queries.


PR created automatically by Jules for task 14714767446794302206 started by @felixbrucker

…L averages

- Add Room Paging 3 dependency and PagingSource query to SleepSessionDao
- Expose Flow<PagingData<SleepSessionEntity>> in SleepRepository and SleepViewModel
- Use collectAsLazyPagingItems in SleepTrackerScreen to paginate sleep records
- Add getAverageDurationSince SQL query to SleepSessionDao for weekly (7 days) and monthly (30 days) average durations
- Update SleepStatsOverview UI to show weekly and monthly averages instead of total duration and overall average
- Update unit and screenshot test suites

Co-authored-by: felixbrucker <5189997+felixbrucker@users.noreply.github.com>
@google-labs-jules

Copy link
Copy Markdown

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@github-actions

github-actions Bot commented Oct 3, 2026 •

Copy link
Copy Markdown

Coverage Report

Overall Project 54.23% -0.08% ❌
Files changed 97.03% 🍏

File Coverage
SleepRepository.kt 97.1% -0.35% 🍏
SleepViewModel.kt 38.58% 🍏

… SQL

- Remove obsolete getAllSessions() from SleepSessionDao and SleepRepository
- Add getAverageWeeklyDuration() and getAverageMonthlyDuration() queries in SleepSessionDao using unixepoch('now', '-7 days') * 1000 and unixepoch('now', '-30 days') * 1000
- Connect weekly and monthly SQL average flows directly to SleepViewModel uiState
- Update unit tests and test fakes for DAO, Repository, and ViewModel

Co-authored-by: felixbrucker <5189997+felixbrucker@users.noreply.github.com>
@felixbrucker
felixbrucker merged commit 1716430 into main Oct 3, 2026
4 checks passed
@felixbrucker
felixbrucker deleted the paginate-sleep-records-sql-averages-14714767446794302206 branch October 3, 2026 13:06
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