Skip to content

Conversation

@Autek
Copy link
Collaborator

@Autek Autek commented Dec 11, 2024

Description:

This PR updates the user interface of QuickFixFinder.kt and, as part of the process, refactors the filtering logic into a dedicated, reusable component.

Key changes include:

  • UI Updates in QuickFixFinder:

    • Remove button with Search and Announce when a search query is entered in search bar
    • add the filtering component when a search query is entered in search bar
  • Refactoring of Filter Logic:

    • Moved all filter-related operations (reapplyFilters, clearFilters, etc.) and UI elements (SearchFilterButtons, FilterRow) from SearchWorkerResult.kt into a new SearchFilters.kt component.
  • Separation of Concerns:

    • QuickFixFinder.kt now focuses on the UI layout and user flow.
    • Filtering logic and UI components are modularized, making them easier to maintain and reuse.

Benefits:

  1. Improved and more intuitive UI within QuickFixFinder.kt.
  2. Cleaner separation of concerns between core filtering logic and the main UI code.
  3. Easier future maintenance and enhancements due to reusable filtering components.

Test Plan:

  • Verify that the updated UI in QuickFixFinder.kt displays as intended.
  • Confirm that all filters (Availability, Service Type, Price Range, Location, and Highest Rating) still work correctly after the refactoring.
  • Ensure the "Clear" button resets all filters and returns the full list of profiles.
  • Check that filter icon colors and transitions behave as expected.

Screenshots:

Capture d’écran 2024-12-14 à 20 58 56 Capture d’écran 2024-12-14 à 20 58 41

@Autek Autek self-assigned this Dec 11, 2024
@Autek Autek marked this pull request as draft December 11, 2024 18:28
@Autek Autek added enhancement Make an existing feature better UI Related to user interface labels Dec 11, 2024
@Autek Autek added this to the Sprint 9 milestone Dec 11, 2024
from SearchWorkerResult.kt to SearchFilters.kt
@Autek Autek force-pushed the feature/quickFixFinder-screen-update-UI branch from 176a641 to 677f084 Compare December 11, 2024 18:42
…een-update-UI

since the project architecture changed the merge conflict was hard to manage
hopefully everything was merged the right way
@Autek Autek force-pushed the feature/quickFixFinder-screen-update-UI branch from 7d7db08 to 7fa722a Compare December 12, 2024 13:29
@Autek
Copy link
Collaborator Author

Autek commented Dec 14, 2024

This PR is almost ready for review!
I just need to do some final code cleanup before marking it as ready. Should be good to go very soon.
Thank you for your patience!

@Autek Autek force-pushed the feature/quickFixFinder-screen-update-UI branch 3 times, most recently from 1533a3d to b904a29 Compare December 14, 2024 17:51
@Autek Autek force-pushed the feature/quickFixFinder-screen-update-UI branch from b904a29 to 513da1f Compare December 14, 2024 19:30
@sonarqubecloud
Copy link

@Autek Autek marked this pull request as ready for review December 14, 2024 19:53
@Autek Autek requested review from daferya, mohagpt and ramshty December 14, 2024 19:54
ramshty
ramshty previously approved these changes Dec 15, 2024
Copy link
Collaborator

@ramshty ramshty left a comment

Choose a reason for hiding this comment

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

Overall really good work and nice effort of modularization. Your code is very clean and concise, i doubt that we could do better. Thanks for your work !!

…een-update-UI

- merge is resolved but not compiling
@Autek Autek force-pushed the feature/quickFixFinder-screen-update-UI branch from 2987272 to 761f367 Compare December 19, 2024 02:20
Copy link
Collaborator

@AnotherMedo AnotherMedo left a comment

Choose a reason for hiding this comment

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

Quite a bit of changes to keep the code maintainable, consistent and bug free. But otherwise great PR!

@ramshty will review the functionality of your branch by checking out to it

Copy link
Collaborator

@AnotherMedo AnotherMedo left a comment

Choose a reason for hiding this comment

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

⚠️ This comment is exclusively for the testing part of your Pull Request.

Please make sure to rollback the changes on tests if you want this PR merged.

I have noticed that you made the test files more trivial and I do not understand why... See the comments for more details.

Comment on lines -77 to 40

@Test
fun profileContent_displaysWorkerProfiles() {
// Set up test data
val testProfiles =
listOf(
WorkerProfile(
uid = "worker0",
fieldOfWork = "Plumbing",
rating = 3.5,
reviews = ArrayDeque(),
location = null, // Simplify for the test
price = 49.0,
),
WorkerProfile(
uid = "worker1",
fieldOfWork = "Electrical",
rating = 3.0,
reviews = ArrayDeque(),
location = null,
price = 59.0,
))

// Mock the AccountViewModel to return sample account data
// Mock AccountViewModel fetchUserAccount
every { accountViewModel.fetchUserAccount(any(), captureLambda()) } answers
{
val uid = firstArg<String>()
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why was this test removed ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

this test was not removed but updated to match the update of the ProfileResults composable. It was replaced by a new test that is testing exactly the same thing

Comment on lines -224 to -243
@Test
fun testTitleAndDescriptionAreDisplayed() {
// Set the composable content
composeTestRule.setContent {
SearchWorkerResult(
navigationActions,
searchViewModel,
accountViewModel,
userViewModel,
preferencesViewModel,
quickFixViewModel,
workerViewModel = workerViewModel)
}
// Set the search query and verify that the title and description match the query
searchViewModel.setSearchQuery("Unknown")

// Check if the description with the query text is displayed
composeTestRule.onAllNodesWithText("Unknown").assertCountEquals(3)
}

Copy link
Collaborator

Choose a reason for hiding this comment

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

Again, why was this test removed ? Once added and passed, tests should in no way be removed. Please restore it

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This test was removed because the searchQuery field in searchViewModel appears to be unused and serves no functional purpose in the codebase. As a result, the test doesn’t provide any meaningful validation. At least from my understanding

Copy link
Collaborator

@Sebbayra Sebbayra left a comment

Choose a reason for hiding this comment

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

I checked out on the branch to check if the filters still work, however there are some functionalities that have been changed and don't work, like for example we can't stack the rating filter on other filters, the emergency one bugs as well and doesn't stack, the location filter doesn't change colors when applied, and the normal search doesn't display results, and I have seen that you have changed the tests for SearchWorkerResult have been changed and I really want their logic and functionality unchanged because they are crucial to ensure that every filter works as intended.

@Autek
Copy link
Collaborator Author

Autek commented Dec 20, 2024

Note: This PR will not be merged as it is too late and there are still some unresolved bugs like @Sebbayra pointed out.
Requested changes are implemented though.

@Autek Autek force-pushed the feature/quickFixFinder-screen-update-UI branch from 1c30bc9 to f6ff04a Compare December 20, 2024 06:04
@AnotherMedo AnotherMedo added invalid This doesn't seem right wontfix This will not be worked on and removed enhancement Make an existing feature better UI Related to user interface labels Dec 20, 2024
@AnotherMedo
Copy link
Collaborator

Note: This PR will not be merged as it is too late and there are still some unresolved bugs like @Sebbayra pointed out. Requested changes are implemented though.

Closing this since it will not be merged as stated in the comment

@AnotherMedo AnotherMedo deleted the feature/quickFixFinder-screen-update-UI branch December 20, 2024 08:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

invalid This doesn't seem right wontfix This will not be worked on

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Update QuickFixFinder UI to add list of workers and filter on search query entered

5 participants