Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,12 @@ fun AdvancedFilterBottomSheet(
location: LocationFilter?,
date: DateFilter?
) -> Unit,
onReset: () -> Unit
onReset: () -> Unit,
initialDate: DateFilter? = null
) {
var selectedPrice by remember { mutableStateOf<PriceFilter?>(null) }
var selectedLocation by remember { mutableStateOf<LocationFilter?>(null) }
var selectedDate by remember { mutableStateOf<DateFilter?>(null) }
var selectedDate by remember { mutableStateOf(initialDate) }

ModalBottomSheet(
onDismissRequest = onDismiss,
Expand Down
18 changes: 9 additions & 9 deletions app/src/main/java/com/cornellappdev/score/screen/HomeScreen.kt
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,12 @@ fun HomeScreen(
sheetState = sheetState,
onDismiss = { showBottomSheet = false },
onApply = { price, location, date ->
// TODO: forward to ViewModel
homeViewModel.onDateFilterApplied(date)
},
onReset = {
// TODO: reset filters in ViewModel
}
homeViewModel.onFiltersReset()
},
initialDate = uiState.selectedDateFilter
Comment on lines 95 to +101
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Price and location filter parameters are silently ignored.

The onApply callback receives price, location, and date, but only date is forwarded to the ViewModel. If the UI allows selecting price/location filters, users may be confused when those selections have no effect.

Consider either:

  1. Disabling price/location sections in AdvancedFilterBottomSheet until implemented, or
  2. Adding a TODO comment to track the remaining filter implementations.

Would you like me to open an issue to track implementing the price and location filters?

🤖 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/HomeScreen.kt` around lines
95 - 101, The AdvancedFilterBottomSheet onApply lambda currently receives price,
location, date but only forwards date via homeViewModel.onDateFilterApplied,
silently ignoring price/location; either disable the price/location UI in
AdvancedFilterBottomSheet until implemented, or add a TODO and a proper
forwarding stub: update the onApply handler in HomeScreen (where onApply = {
price, location, date -> ... }) to either (A) call a new ViewModel method
homeViewModel.onFiltersApplied(price, location, date) (create a stub
onFiltersApplied in HomeViewModel to accept price and location and wire it
later), or (B) add a clear TODO comment in the onApply block and disable the
price/location sections in AdvancedFilterBottomSheet so selections are not
available to users; also ensure onReset still calls homeViewModel.onFiltersReset
and initialDate uses uiState.selectedDateFilter.

)
}
}
Expand Down Expand Up @@ -171,12 +172,11 @@ private fun HomeLazyColumn(
text = "Game Schedule",
style = title,
)
//removed for 2/2026 release
// IconButton(
// icon = painterResource(id = R.drawable.advanced_filter),
// contentDescription = "Advanced filter",
// onClick = onAdvancedFilterClick
// )
IconButton(
icon = painterResource(id = R.drawable.advanced_filter),
contentDescription = "Advanced filter",
onClick = onAdvancedFilterClick
)
}
Spacer(modifier = Modifier.height(16.dp))
SportSelectorHeader(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.cornellappdev.score.viewmodel

import com.cornellappdev.score.components.DateFilter
import com.cornellappdev.score.model.ApiResponse
import com.cornellappdev.score.model.GameCardData
import com.cornellappdev.score.model.GenderDivision
Expand All @@ -16,15 +17,24 @@ data class HomeUiState(
val selectedGender: GenderDivision,
val sportSelect: SportSelection,
val selectionList: List<SportSelection>,
val loadedState: ApiResponse<List<GameCardData>>
val loadedState: ApiResponse<List<GameCardData>>,
val selectedDateFilter: DateFilter? = null
) {
//TODO: refactor filters to use flows - not best practice to expose original games list to the view
val filteredGames: List<GameCardData>
get() = when (loadedState) {
is ApiResponse.Success -> loadedState.data.filter { game ->
(selectedGender == GenderDivision.ALL || game.gender == selectedGender.displayName) &&
(sportSelect is SportSelection.All ||
(sportSelect is SportSelection.SportSelect && game.sport == sportSelect.sport.displayName))
val genderMatch = selectedGender == GenderDivision.ALL || game.gender == selectedGender.displayName
val sportMatch = sportSelect is SportSelection.All ||
(sportSelect is SportSelection.SportSelect && game.sport == sportSelect.sport.displayName)
val dateMatch = when (selectedDateFilter) {
DateFilter.TODAY -> game.date == LocalDate.now()
DateFilter.WITHIN_7_DAYS -> game.date != null && !game.date.isAfter(LocalDate.now().plusDays(7))
DateFilter.WITHIN_A_MONTH -> game.date != null && !game.date.isAfter(LocalDate.now().plusDays(30))
DateFilter.OVER_A_MONTH -> game.date != null && game.date.isAfter(LocalDate.now().plusDays(30))
null -> true
}
genderMatch && sportMatch && dateMatch
}

ApiResponse.Loading -> emptyList()
Expand Down Expand Up @@ -91,4 +101,12 @@ class HomeViewModel @Inject constructor(
)
}
}

fun onDateFilterApplied(date: DateFilter?) {
applyMutation { copy(selectedDateFilter = date) }
}

fun onFiltersReset() {
applyMutation { copy(selectedDateFilter = null) }
}
}
Loading