-
Notifications
You must be signed in to change notification settings - Fork 527
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create a generic utility for filtering enums #3146
Comments
I want to work on this issue. |
@whyash8, Please feel free to put up a draft PR with a solution. |
Ok sir |
i have found a solution for the issue and i need some guidance. please help! |
Hi @whyash8, please let us know how we can help. What challenge are you experiencing? |
i made some changes in the code. Now i need help in testing the changes. Please help |
@whyash8, could you please create a PR with the code changes so that we can better help with the required tests? |
Ok |
I am getting this issues while pushing Ktlint issue found. |
Hi @whyash8, go to your project folder > oppia-android-tools > delete the ktlint file. Then on you terminal inside the project root, run |
Ok! thank you |
i made a PR . please help me to proceed further. |
This comment was marked as off-topic.
This comment was marked as off-topic.
@whyash8, if facing an issue that's not related to the issue, please post under the affected PR or discussions to avoid loss of context and cluttering the issue thread |
## Explanation Fixes: oppia#3146 This PR introduces a new utility function filterByEnumCondition to standardize filtering of enums across various parts of the oppia-android codebase. This utility function allows filtering of collections based on a condition applied to enum values. This PR introduces a new utility function filterByEnumCondition to standardize filtering of enums across various parts of the oppia-android codebase. This utility function allows filtering of collections based on a condition applied to enum values. **Key Changes**: Added Utility Function: filterByEnumCondition: A generic function to filter a collection based on a condition applied to an enum extracted from each item in the collection. **Updated Existing Code**: Refactored code in getLeastRecentMetricLogIndex, getLeastRecentMediumPriorityEventIndex, and other methods to utilize the new filterByEnumCondition function. Updated the calculation of completedChapterCount and inProgressChapterCount using the new utility function. ## Essential Checklist <!-- Please tick the relevant boxes by putting an "x" in them. --> - [ x] The PR title and explanation each start with "Fix #bugnum: " (If this PR fixes part of an issue, prefix the title with "Fix part of #bugnum: ...".) - [x ] Any changes to [scripts/assets](https://github.com/oppia/oppia-android/tree/develop/scripts/assets) files have their rationale included in the PR explanation. - [x ] The PR follows the [style guide](https://github.com/oppia/oppia-android/wiki/Coding-style-guide). - [x ] The PR does not contain any unnecessary code changes from Android Studio ([reference](https://github.com/oppia/oppia-android/wiki/Guidance-on-submitting-a-PR#undo-unnecessary-changes)). - [ x] The PR is made from a branch that's **not** called "develop" and is up-to-date with "develop". - [x ] The PR is **assigned** to the appropriate reviewers ([reference](https://github.com/oppia/oppia-android/wiki/Guidance-on-submitting-a-PR#clarification-regarding-assignees-and-reviewers-section)). - --------- Co-authored-by: Adhiambo Peres <[email protected]>
Is your feature request related to a problem? Please describe.
Currently, in all our enum files, we usually use similar items filtering.
Some examples of filtering include:
oppia-android/app/src/main/java/org/oppia/android/app/survey/surveyitemviewmodel/UserTypeItemsViewModel.kt
Line 146 in d0c8b81
oppia-android/domain/src/main/java/org/oppia/android/domain/oppialogger/analytics/PerformanceMetricsController.kt
Line 132 in d0c8b81
oppia-android/app/src/main/java/org/oppia/android/app/topic/lessons/TopicLessonsFragmentPresenter.kt
Line 162 in d0c8b81
Describe the solution you'd like
Generalize filtering which can be used by all the enum.
Describe alternatives you've considered
Additional context
Look here for learning purpose - https://gist.github.com/programmerr47/e1a62f912c735249c89c3f5c44b6b366#file-enum-kt
The text was updated successfully, but these errors were encountered: