Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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 @@ -24,12 +24,21 @@ data class HomeUiState(
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))
&& (game.sport == "Baseball" || game.sport == "Basketball" || game.sport == "Field Hockey" || game.sport == "Football" || game.sport == "Ice Hockey" || game.sport == "Lacrosse" || game.sport == "Soccer")
}

ApiResponse.Loading -> emptyList()
ApiResponse.Error -> emptyList()
}
val upcomingGames: List<GameCardData> = filteredGames.take(3)
val upcomingGames: List<GameCardData>
get() = when (loadedState) {
is ApiResponse.Success -> loadedState.data.filter { game ->
(game.sport == "Baseball" || game.sport == "Basketball" || game.sport == "Field Hockey" || game.sport == "Football" || game.sport == "Ice Hockey" || game.sport == "Lacrosse" || game.sport == "Soccer")
}

ApiResponse.Loading -> emptyList()
ApiResponse.Error -> emptyList()
}.take(3)
}

@HiltViewModel
Expand All @@ -39,7 +48,9 @@ class HomeViewModel @Inject constructor(
HomeUiState(
selectedGender = GenderDivision.ALL,
sportSelect = SportSelection.All,
selectionList = Sport.getSportSelectionList(),
selectionList = Sport.getSportSelectionList().filter {
it is SportSelection.All || (it is SportSelection.SportSelect && (it.sport.displayName == "Baseball" || it.sport.displayName == "Basketball" || it.sport.displayName == "Field Hockey" || it.sport.displayName == "Football" || it.sport.displayName == "Ice Hockey" || it.sport.displayName == "Lacrosse" || it.sport.displayName == "Soccer"))
},
loadedState = ApiResponse.Loading
)
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,21 @@ data class PastGamesUiState(
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))
&& (game.sport == "Baseball" || game.sport == "Basketball" || game.sport == "Field Hockey" || game.sport == "Football" || game.sport == "Ice Hockey" || game.sport == "Lacrosse" || game.sport == "Soccer")
}

ApiResponse.Loading -> emptyList()
ApiResponse.Error -> emptyList()
}
val pastGames: List<GameCardData> = filteredGames.take(3)
val pastGames: List<GameCardData>
get() = when (loadedState) {
is ApiResponse.Success -> loadedState.data.filter { game ->
(game.sport == "Baseball" || game.sport == "Basketball" || game.sport == "Field Hockey" || game.sport == "Football" || game.sport == "Ice Hockey" || game.sport == "Lacrosse" || game.sport == "Soccer")
}

ApiResponse.Loading -> emptyList()
ApiResponse.Error -> emptyList()
}.take(3)
}

@HiltViewModel
Expand All @@ -39,7 +48,9 @@ class PastGamesViewModel @Inject constructor(
PastGamesUiState(
selectedGender = GenderDivision.ALL,
sportSelect = SportSelection.All,
selectionList = Sport.getSportSelectionList(),
selectionList = Sport.getSportSelectionList().filter {
it is SportSelection.All || (it is SportSelection.SportSelect && (it.sport.displayName == "Baseball" || it.sport.displayName == "Basketball" || it.sport.displayName == "Field Hockey" || it.sport.displayName == "Football" || it.sport.displayName == "Ice Hockey" || it.sport.displayName == "Lacrosse" || it.sport.displayName == "Soccer"))
},
loadedState = ApiResponse.Loading
)
) {
Expand Down