Skip to content

Conversation

@amjiao
Copy link
Contributor

@amjiao amjiao commented Apr 14, 2025

Overview

Changes Made

Updated Sport enum class to include a gender property so that getSportSelectionList can return a filtered list given a specified gender.

Test Coverage

Ran the emulator, filtering behavior appears to be working correctly

Related PRs or Issues (delete if not applicable)

issue #40

@amjiao amjiao requested a review from zachseidner1 April 14, 2025 19:24
@zachseidner1 zachseidner1 linked an issue Apr 14, 2025 that may be closed by this pull request
Copy link
Collaborator

@zachseidner1 zachseidner1 left a comment

Choose a reason for hiding this comment

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

Nice job! There's one note for code readability you can address, and then after that feel free to merge.

Comment on lines 171 to 175
null -> Sport.entries
GenderDivision.MALE -> Sport.entries.filter { it.gender == GenderDivision.MALE || it.gender == GenderDivision.ALL }
GenderDivision.FEMALE -> Sport.entries.filter { it.gender == GenderDivision.FEMALE || it.gender == GenderDivision.ALL }
GenderDivision.ALL -> Sport.entries
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

you can combine cases with the same result in a when statement as such:

GenderDivision.MALE -> Sport.entries.filter { it.gender == GenderDivision.MALE || it.gender == GenderDivision.ALL }
                GenderDivision.FEMALE -> Sport.entries.filter { it.gender == GenderDivision.FEMALE || it.gender == GenderDivision.ALL }
                GenderDivision.ALL,
                null -> Sport.entries

@amjiao amjiao merged commit d475d5d into main Apr 14, 2025
1 check passed
@amjiao amjiao deleted the Amy/sport-filter-fix branch April 14, 2025 22:27
amjiao added a commit that referenced this pull request Apr 15, 2025
* Fix sport filter

* Small readability fix
amjiao added a commit that referenced this pull request Apr 22, 2025
* Empty state + UI fixes

* Address UI issues (#51)

* Add missing border

* Bump material version in preparation for pull to refresh

* Fix border on home and past, fix carousel
# Conflicts:
#	app/src/main/java/com/cornellappdev/score/screen/HomeScreen.kt
#	app/src/main/java/com/cornellappdev/score/screen/PastGamesScreen.kt

* Address sport filter (issue #40) (#47)

* Fix sport filter

* Small readability fix

* Empty state + UI fixes

* Fix merging

* small fix

* PR Fixes

* Small fixes

* PR fixes

---------

Co-authored-by: Zachary Seidner <[email protected]>
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.

Change sports filter based on gender

3 participants