Conversation
UIState no longer exposes the raw backend list. Filtered highlights are now precomputed in the ViewModel, so the UI can observe state directly without recalculating on every recomposition.
|
The PR description image shows the Highlights screen of the Score Android app, displaying:
✅ Actions performedReview triggered.
|
📝 WalkthroughWalkthroughThis PR introduces a comprehensive highlights feature, including new GraphQL queries and schema extensions, data models with date handling, a repository layer for fetching highlights, MVVM-based view models for state management, updated UI components with sport filtering, and navigation updates to support the highlights search functionality. Changes
Sequence DiagramsequenceDiagram
participant User as User/UI
participant ViewModel as HighlightsViewModel
participant Repo as HighlightsRepository
participant Apollo as Apollo Client
participant API as GraphQL API
participant Data as State Flow
User->>ViewModel: Init / onRefresh()
ViewModel->>ViewModel: Set state to Loading
ViewModel->>Repo: fetchHighlights()
Repo->>Repo: Set highlightsFlow to Loading
Repo->>Apollo: Execute Highlights query
Apollo->>API: GraphQL request
API-->>Apollo: articles + youtubeVideos
Apollo-->>Repo: Query result
Repo->>Repo: Map to HighlightData (toHighlightData)
Repo->>Repo: Emit ApiResponse.Success
Repo-->>Data: highlightsFlow updated
Data-->>ViewModel: Collect response
ViewModel->>ViewModel: Sort by date, compute derived lists
ViewModel-->>User: Render Success state with highlights
User->>ViewModel: onSportSelected(SportSelection)
ViewModel->>ViewModel: Filter highlights by sport
ViewModel->>ViewModel: Recompute derived lists
ViewModel-->>User: Update UI with filtered highlights
Estimated Code Review Effort🎯 4 (Complex) | ⏱️ ~60 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
📝 Coding Plan
Comment |
There was a problem hiding this comment.
Actionable comments posted: 5
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
app/src/main/java/com/cornellappdev/score/screen/HighlightsSubScreen.kt (1)
99-99:⚠️ Potential issue | 🟠 MajorThe
navigateBackparameter is not being used.
HighlightsSubScreenHeaderis called with an empty lambda{}instead of the actualnavigateBackcallback passed toHighlightsSubScreen. This breaks the back navigation functionality.🐛 Proposed fix
- HighlightsSubScreenHeader(header, {}) + HighlightsSubScreenHeader(header, navigateBack = onCloseClick)Note: Using
onCloseClickas it appears to be the intended close/back action. Alternatively, add a dedicatednavigateBackparameter if distinct behavior is needed.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@app/src/main/java/com/cornellappdev/score/screen/HighlightsSubScreen.kt` at line 99, HighlightsSubScreen is passing an empty lambda to HighlightsSubScreenHeader which ignores the provided navigateBack callback; replace the empty lambda with the actual navigateBack callback so the header's onCloseClick (or the intended close/back action) invokes navigateBack. Locate the call to HighlightsSubScreenHeader in HighlightsSubScreen and pass navigateBack (or wire navigateBack into onCloseClick) instead of {} to restore back navigation.
🧹 Nitpick comments (4)
app/src/main/java/com/cornellappdev/score/viewmodel/HighlightsViewModel.kt (1)
41-41: Inconsistent sort order:filteredsorted ascending whileloadedStatedata is descending.Line 72 sorts
response.datadescending by date before callingbuildDerivedLists, but line 41 re-sortsfilteredascending. This inconsistency may cause confusion. Clarify the intended order or align them.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@app/src/main/java/com/cornellappdev/score/viewmodel/HighlightsViewModel.kt` at line 41, filtered is currently sorted ascending (val filtered = validHighlights.sortedBy { it.date }) while elsewhere (response.data before buildDerivedLists and loadedState) uses descending order; make the ordering consistent by changing filtered to use descending sorting (e.g., use sortedByDescending { it.date }) or, if ascending is intended, adjust the earlier descending sort in the loadedState/response.data preparation and buildDerivedLists call to ascending—update the filtered declaration and any related assumptions in buildDerivedLists/loadedState to match the chosen order.app/src/main/java/com/cornellappdev/score/model/Highlights.kt (1)
67-71: Gender inference logic may be incomplete.The code assumes
FEMALEif the title doesn't contain "Men's". This doesn't account for:
- Co-ed sports
- Titles without gender indication (e.g., "Cornell Tennis Wins Championship")
- "Women's" explicit match
Consider making
gendernullable or adding explicit "Women's" check:♻️ Proposed alternative
gender = if (title.contains("Men's")) { GenderDivision.MALE - } else { + } else if (title.contains("Women's")) { GenderDivision.FEMALE - }, + } else { + null // Unknown gender + },🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@app/src/main/java/com/cornellappdev/score/model/Highlights.kt` around lines 67 - 71, The gender inference in the Highlights.kt assignment currently sets GenderDivision.FEMALE whenever title does not contain "Men's"; update the logic in the gender assignment (the expression using title.contains("Men's")) to explicitly detect "Men's" -> GenderDivision.MALE, "Women's" (or "Women’s") -> GenderDivision.FEMALE, and common co‑ed indicators (e.g., "Co‑ed", "Coed", "Mixed") -> GenderDivision.COED if you have that enum, otherwise set gender to null; make the gender field nullable in the containing data class/constructor if not already and use case‑insensitive matching on the title string to avoid false negatives.app/src/main/java/com/cornellappdev/score/util/TestingConstants.kt (1)
231-283: Test data withnulldates will be filtered out by ViewModel.All highlights in
highlightsListhavedate = null(e.g., line 237). InHighlightsViewModel.buildDerivedLists(), line 32 filters out highlights with null dates:.filter { it.date != null }. This means these test highlights won't appear intodayHighlightsorpastThreeDaysHighlightsduring preview/testing.Consider using actual
LocalDatevalues for more realistic test coverage:♻️ Proposed fix example
HighlightData.Video (VideoHighlightData( "vs Columbia", "maxresdefault.jpg", "https://cornellsun.com/article/london-mcdavid-is-making-a-name-for-herself-at-cornell", - null, + LocalDate.now(), "11/09", Sport.BASEBALL, GenderDivision.MALE, "0:44" )),🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@app/src/main/java/com/cornellappdev/score/util/TestingConstants.kt` around lines 231 - 283, The test highlights in highlightsList use null dates so they get filtered out by HighlightsViewModel.buildDerivedLists() (.filter { it.date != null }); update the HighlightData instances (VideoHighlightData and ArticleHighlightData inside highlightsList) to supply concrete LocalDate values (e.g., LocalDate.now() and LocalDate.now().minusDays(1/2/3) as appropriate) instead of null so the preview/test data appears in todayHighlights and pastThreeDaysHighlights; ensure the date field types match the model (LocalDate) and adjust any imports or constructors if needed.app/src/main/java/com/cornellappdev/score/screen/HighlightsScreen.kt (1)
49-52: TODO: Create highlights-specific loading screen.The comment acknowledges that
LoadingScreenwith "Loading Schedules..." text is inappropriate for the highlights feature. Track this for follow-up.Do you want me to open an issue to track creating a highlights-specific loading screen?
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@app/src/main/java/com/cornellappdev/score/screen/HighlightsScreen.kt` around lines 49 - 52, The HighlightsScreen currently shows a generic LoadingScreen with "Loading Schedules..." in the ApiResponse.Loading branch; replace this with a highlights-specific loading UI by creating a new component (e.g., HighlightsLoadingScreen) or updating LoadingScreen to accept contextual text, then use that from HighlightsScreen (replace the LoadingScreen call in the ApiResponse.Loading branch). Ensure the new component or prop displays "Loading Highlights..." (and any highlights-specific placeholders) and update any references to LoadingScreen in HighlightsScreen to call the new name or pass the appropriate prop so the loading text is correct.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@app/src/main/java/com/cornellappdev/score/model/HighlightsRepository.kt`:
- Around line 26-29: The KDoc at the top of HighlightsRepository incorrectly
mentions "games" and `upcomingGamesFlow`; update the comment to describe
fetching highlights and emitting the repository's highlights flow (e.g.,
`highlightsFlow` or the actual flow property in HighlightsRepository). Edit the
comment block above the asynchronous fetch method or class to reference
highlights, the correct flow name used in this file, and briefly state its
behavior (asynchronous fetch and emission) so the documentation matches
functions like HighlightsRepository.fetch... and the highlights flow identifier.
In `@app/src/main/java/com/cornellappdev/score/screen/HighlightsScreen.kt`:
- Around line 59-61: The pull-to-refresh indicator never shows because
ScorePullToRefreshBox's isRefreshing uses uiState.loadedState ==
ApiResponse.Loading inside the ApiResponse.Success branch; add a dedicated
boolean refresh state and wire it through the ViewModel instead of reusing
loadedState. Update HighlightsUiState to include isRefreshing (or add a separate
loading state), set and clear it from highlightsViewModel.onRefresh()/refresh
handling, and pass uiState.isRefreshing to ScorePullToRefreshBox.isRefreshing so
the indicator can show while content is displayed (referencing
ScorePullToRefreshBox, uiState.loadedState, HighlightsUiState, and
highlightsViewModel.onRefresh).
In `@app/src/main/java/com/cornellappdev/score/util/DateUtil.kt`:
- Around line 72-76: Update the KDoc for the ISO-8601 parsing function in
DateUtil.kt so the `@return` matches the actual return type (nullable LocalDate)
instead of stating LocalDateTime; explicitly document that the function returns
a LocalDate? (nullable) and that it returns null for invalid/unsupported
formats, and keep the format example ("yyyy-MM-dd'T'HH:mm:ss'Z'") and parameter
description unchanged so readers can find the parsing function (DateUtil's
ISO-8601 parsing method) and understand the nullable return contract.
- Around line 82-83: The catch block in DateUtil.kt that currently swallows
exceptions and returns null should instead log a warning before returning null:
update the catch (e: Exception) block inside the date-parsing function to call
your logging facility (e.g., Log.w or Timber.w) with a concise message that
includes the exception and the offending input string/variable (so we can
identify which timestamp failed) and then continue returning null to preserve
behavior.
In `@app/src/main/java/com/cornellappdev/score/viewmodel/HighlightsViewModel.kt`:
- Around line 43-48: pastThreeDaysHighlights currently uses filter { it.date!!
>= threeDaysAgo } which includes today and duplicates items in todayHighlights;
update the filter in HighlightsViewModel.kt to exclude today by requiring the
date be >= threeDaysAgo AND < today (e.g., filter { val d = it.date!!; d >=
threeDaysAgo && d < today }) so pastThreeDaysHighlights covers only the prior 3
days and not today's items.
---
Outside diff comments:
In `@app/src/main/java/com/cornellappdev/score/screen/HighlightsSubScreen.kt`:
- Line 99: HighlightsSubScreen is passing an empty lambda to
HighlightsSubScreenHeader which ignores the provided navigateBack callback;
replace the empty lambda with the actual navigateBack callback so the header's
onCloseClick (or the intended close/back action) invokes navigateBack. Locate
the call to HighlightsSubScreenHeader in HighlightsSubScreen and pass
navigateBack (or wire navigateBack into onCloseClick) instead of {} to restore
back navigation.
---
Nitpick comments:
In `@app/src/main/java/com/cornellappdev/score/model/Highlights.kt`:
- Around line 67-71: The gender inference in the Highlights.kt assignment
currently sets GenderDivision.FEMALE whenever title does not contain "Men's";
update the logic in the gender assignment (the expression using
title.contains("Men's")) to explicitly detect "Men's" -> GenderDivision.MALE,
"Women's" (or "Women’s") -> GenderDivision.FEMALE, and common co‑ed indicators
(e.g., "Co‑ed", "Coed", "Mixed") -> GenderDivision.COED if you have that enum,
otherwise set gender to null; make the gender field nullable in the containing
data class/constructor if not already and use case‑insensitive matching on the
title string to avoid false negatives.
In `@app/src/main/java/com/cornellappdev/score/screen/HighlightsScreen.kt`:
- Around line 49-52: The HighlightsScreen currently shows a generic
LoadingScreen with "Loading Schedules..." in the ApiResponse.Loading branch;
replace this with a highlights-specific loading UI by creating a new component
(e.g., HighlightsLoadingScreen) or updating LoadingScreen to accept contextual
text, then use that from HighlightsScreen (replace the LoadingScreen call in the
ApiResponse.Loading branch). Ensure the new component or prop displays "Loading
Highlights..." (and any highlights-specific placeholders) and update any
references to LoadingScreen in HighlightsScreen to call the new name or pass the
appropriate prop so the loading text is correct.
In `@app/src/main/java/com/cornellappdev/score/util/TestingConstants.kt`:
- Around line 231-283: The test highlights in highlightsList use null dates so
they get filtered out by HighlightsViewModel.buildDerivedLists() (.filter {
it.date != null }); update the HighlightData instances (VideoHighlightData and
ArticleHighlightData inside highlightsList) to supply concrete LocalDate values
(e.g., LocalDate.now() and LocalDate.now().minusDays(1/2/3) as appropriate)
instead of null so the preview/test data appears in todayHighlights and
pastThreeDaysHighlights; ensure the date field types match the model (LocalDate)
and adjust any imports or constructors if needed.
In `@app/src/main/java/com/cornellappdev/score/viewmodel/HighlightsViewModel.kt`:
- Line 41: filtered is currently sorted ascending (val filtered =
validHighlights.sortedBy { it.date }) while elsewhere (response.data before
buildDerivedLists and loadedState) uses descending order; make the ordering
consistent by changing filtered to use descending sorting (e.g., use
sortedByDescending { it.date }) or, if ascending is intended, adjust the earlier
descending sort in the loadedState/response.data preparation and
buildDerivedLists call to ascending—update the filtered declaration and any
related assumptions in buildDerivedLists/loadedState to match the chosen order.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: d99ea79c-3618-43a1-80ed-9ea11e23e457
📒 Files selected for processing (18)
app/src/main/graphql/Highlights.graphqlapp/src/main/graphql/schema.graphqlsapp/src/main/java/com/cornellappdev/score/components/highlights/ArticleHighlightsCard.ktapp/src/main/java/com/cornellappdev/score/components/highlights/HighlightsFilter.ktapp/src/main/java/com/cornellappdev/score/components/highlights/HighlightsScreenSearchFilterBar.ktapp/src/main/java/com/cornellappdev/score/components/highlights/HighlightsSearchBar.ktapp/src/main/java/com/cornellappdev/score/components/highlights/VideoHighlightsCard.ktapp/src/main/java/com/cornellappdev/score/model/Highlights.ktapp/src/main/java/com/cornellappdev/score/model/HighlightsRepository.ktapp/src/main/java/com/cornellappdev/score/nav/ScoreNavHost.ktapp/src/main/java/com/cornellappdev/score/nav/root/RootNavigation.ktapp/src/main/java/com/cornellappdev/score/screen/HighlightsScreen.ktapp/src/main/java/com/cornellappdev/score/screen/HighlightsSearchScreen.ktapp/src/main/java/com/cornellappdev/score/screen/HighlightsSubScreen.ktapp/src/main/java/com/cornellappdev/score/screen/HomeScreen.ktapp/src/main/java/com/cornellappdev/score/util/DateUtil.ktapp/src/main/java/com/cornellappdev/score/util/TestingConstants.ktapp/src/main/java/com/cornellappdev/score/viewmodel/HighlightsViewModel.kt
| /** | ||
| * Asynchronously fetches the list of games from the API. Once finished, will send down | ||
| * `upcomingGamesFlow` to be observed. | ||
| */ |
There was a problem hiding this comment.
Incorrect comment: references "games" instead of "highlights".
The doc comment mentions "upcomingGamesFlow" which appears to be copy-pasted from another repository. Update to reflect this class.
📝 Proposed fix
/**
- * Asynchronously fetches the list of games from the API. Once finished, will send down
- * `upcomingGamesFlow` to be observed.
+ * Asynchronously fetches the list of highlights from the API. Once finished, will send down
+ * `highlightsFlow` to be observed.
*/📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| /** | |
| * Asynchronously fetches the list of games from the API. Once finished, will send down | |
| * `upcomingGamesFlow` to be observed. | |
| */ | |
| /** | |
| * Asynchronously fetches the list of highlights from the API. Once finished, will send down | |
| * `highlightsFlow` to be observed. | |
| */ |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@app/src/main/java/com/cornellappdev/score/model/HighlightsRepository.kt`
around lines 26 - 29, The KDoc at the top of HighlightsRepository incorrectly
mentions "games" and `upcomingGamesFlow`; update the comment to describe
fetching highlights and emitting the repository's highlights flow (e.g.,
`highlightsFlow` or the actual flow property in HighlightsRepository). Edit the
comment block above the asynchronous fetch method or class to reference
highlights, the correct flow name used in this file, and briefly state its
behavior (asynchronous fetch and emission) so the documentation matches
functions like HighlightsRepository.fetch... and the highlights flow identifier.
| ScorePullToRefreshBox( | ||
| isRefreshing = uiState.loadedState == ApiResponse.Loading, | ||
| { highlightsViewModel.onRefresh() } |
There was a problem hiding this comment.
isRefreshing will always be false inside the Success branch.
The condition uiState.loadedState == ApiResponse.Loading is checked inside the ApiResponse.Success branch of the when statement. By definition, if we're in the Success branch, loadedState cannot be Loading, so the pull-to-refresh indicator will never show.
🐛 Proposed fix
Option 1: Add a dedicated isRefreshing state to HighlightsUiState:
// In HighlightsUiState:
data class HighlightsUiState(
val isRefreshing: Boolean = false,
// ... other fields
)Option 2: Track loading state separately from content state, allowing "refreshing while showing stale data" pattern.
The current architecture clears content during refresh, so the Success branch exits immediately when refreshing starts.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@app/src/main/java/com/cornellappdev/score/screen/HighlightsScreen.kt` around
lines 59 - 61, The pull-to-refresh indicator never shows because
ScorePullToRefreshBox's isRefreshing uses uiState.loadedState ==
ApiResponse.Loading inside the ApiResponse.Success branch; add a dedicated
boolean refresh state and wire it through the ViewModel instead of reusing
loadedState. Update HighlightsUiState to include isRefreshing (or add a separate
loading state), set and clear it from highlightsViewModel.onRefresh()/refresh
handling, and pass uiState.isRefreshing to ScorePullToRefreshBox.isRefreshing so
the indicator can show while content is displayed (referencing
ScorePullToRefreshBox, uiState.loadedState, HighlightsUiState, and
highlightsViewModel.onRefresh).
| * Parses an ISO-8601 timestamp: yyyy-MM-dd'T'HH:mm:ss'Z' into a LocalDateTime object. | ||
| * | ||
| * @param strDate the date string to parse, in the format "yyyy-MM-dd'T'HH:mm:ss'Z'" | ||
| * @return a LocalDateTime object if parsing succeeds, or null if the format is invalid | ||
| */ |
There was a problem hiding this comment.
Fix return-type mismatch in KDoc.
The doc says this returns LocalDateTime, but the function returns LocalDate?. Please align the comment to prevent misuse.
Proposed doc fix
- * Parses an ISO-8601 timestamp: yyyy-MM-dd'T'HH:mm:ss'Z' into a LocalDateTime object.
+ * Parses an ISO-8601 timestamp: yyyy-MM-dd'T'HH:mm:ss'Z' into a LocalDate object.
@@
- * `@return` a LocalDateTime object if parsing succeeds, or null if the format is invalid
+ * `@return` a LocalDate object if parsing succeeds, or null if the format is invalid📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| * Parses an ISO-8601 timestamp: yyyy-MM-dd'T'HH:mm:ss'Z' into a LocalDateTime object. | |
| * | |
| * @param strDate the date string to parse, in the format "yyyy-MM-dd'T'HH:mm:ss'Z'" | |
| * @return a LocalDateTime object if parsing succeeds, or null if the format is invalid | |
| */ | |
| * Parses an ISO-8601 timestamp: yyyy-MM-dd'T'HH:mm:ss'Z' into a LocalDate object. | |
| * | |
| * `@param` strDate the date string to parse, in the format "yyyy-MM-dd'T'HH:mm:ss'Z'" | |
| * `@return` a LocalDate object if parsing succeeds, or null if the format is invalid | |
| */ |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@app/src/main/java/com/cornellappdev/score/util/DateUtil.kt` around lines 72 -
76, Update the KDoc for the ISO-8601 parsing function in DateUtil.kt so the
`@return` matches the actual return type (nullable LocalDate) instead of stating
LocalDateTime; explicitly document that the function returns a LocalDate?
(nullable) and that it returns null for invalid/unsupported formats, and keep
the format example ("yyyy-MM-dd'T'HH:mm:ss'Z'") and parameter description
unchanged so readers can find the parsing function (DateUtil's ISO-8601 parsing
method) and understand the nullable return contract.
| } catch (e: Exception) { | ||
| null |
There was a problem hiding this comment.
Avoid silently swallowing parse failures.
Right now malformed timestamps disappear without signal. Adding a warning log keeps behavior (null) while improving diagnosability.
Proposed fix
- } catch (e: Exception) {
- null
- }
+ } catch (e: Exception) {
+ Log.w("parseIsoDateToLocalDateOrNull", "Invalid ISO timestamp: $strDate", e)
+ null
+ }📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| } catch (e: Exception) { | |
| null | |
| } catch (e: Exception) { | |
| Log.w("parseIsoDateToLocalDateOrNull", "Invalid ISO timestamp: $strDate", e) | |
| null | |
| } |
🧰 Tools
🪛 detekt (1.23.8)
[warning] 82-82: The caught exception is swallowed. The original exception could be lost.
(detekt.exceptions.SwallowedException)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@app/src/main/java/com/cornellappdev/score/util/DateUtil.kt` around lines 82 -
83, The catch block in DateUtil.kt that currently swallows exceptions and
returns null should instead log a warning before returning null: update the
catch (e: Exception) block inside the date-parsing function to call your logging
facility (e.g., Log.w or Timber.w) with a concise message that includes the
exception and the offending input string/variable (so we can identify which
timestamp failed) and then continue returning null to preserve behavior.
| val todayHighlights = validHighlights.filter { it.date == today } | ||
|
|
||
| val pastThreeDaysHighlights = validHighlights | ||
| .filter { it.date!! >= threeDaysAgo } // null dates filtered out in line 32 | ||
| .sortedBy { it.date } | ||
|
|
There was a problem hiding this comment.
pastThreeDaysHighlights includes today's items, causing overlap with todayHighlights.
The filter it.date!! >= threeDaysAgo includes all dates from 3 days ago up to and including today. This means items in todayHighlights will also appear in pastThreeDaysHighlights, potentially causing duplicate display in the UI.
If the intent is to show "past 3 days excluding today":
🐛 Proposed fix
val pastThreeDaysHighlights = validHighlights
- .filter { it.date!! >= threeDaysAgo } // null dates filtered out in line 32
+ .filter { it.date!! in threeDaysAgo..<today } // exclude today
.sortedBy { it.date }Alternatively, if including today is intentional, the UI should handle deduplication.
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| val todayHighlights = validHighlights.filter { it.date == today } | |
| val pastThreeDaysHighlights = validHighlights | |
| .filter { it.date!! >= threeDaysAgo } // null dates filtered out in line 32 | |
| .sortedBy { it.date } | |
| val todayHighlights = validHighlights.filter { it.date == today } | |
| val pastThreeDaysHighlights = validHighlights | |
| .filter { it.date!! in threeDaysAgo..<today } // exclude today | |
| .sortedBy { it.date } |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@app/src/main/java/com/cornellappdev/score/viewmodel/HighlightsViewModel.kt`
around lines 43 - 48, pastThreeDaysHighlights currently uses filter { it.date!!
>= threeDaysAgo } which includes today and duplicates items in todayHighlights;
update the filter in HighlightsViewModel.kt to exclude today by requiring the
date be >= threeDaysAgo AND < today (e.g., filter { val d = it.date!!; d >=
threeDaysAgo && d < today }) so pastThreeDaysHighlights covers only the prior 3
days and not today's items.
Overview
highlights UI bug fixes/improvements, initial highlights networking
Changes Made
Test Coverage
visually matches figma, double checked that all highlights in specified date range are shown
Next Steps
Screenshots (delete if not applicable)
(note, we realized showing only "today" and "past 3 day" categories could be a flaw in cases like this where there's very few recent highlights. our designer is working on improving this!)
Summary by CodeRabbit
Release Notes
New Features
Improvements