Skip to content

Conversation

@mehdi-hamirifou
Copy link
Contributor

This pull request solves issue #209

Note: Drafted due to a bug that may necessitate significant changes in the Google Maps implementation.

@mehdi-hamirifou mehdi-hamirifou linked an issue Dec 13, 2024 that may be closed by this pull request
…ter update

- Updated the selected post of the viewmodel to ensure the mapview's selectedPost value is set to the updated post. This allows MapView to maintain continuous updates of the parameters in the image preview dialog.

- Removed unnecessary launched effect
… view

- Updated PostItem to display ratings only if wanted
- Refactored GoogleMap and MapView so that ratings don't display when selecting a post
- Made ImagePreviewDialog deny the display of ratings
- Replaced testStarIsDisplayed with testStarIsNotDisplay
- Commented out testStarClickClassUdpatePost as it isn't meaningful anymore
@mehdi-hamirifou mehdi-hamirifou marked this pull request as ready for review December 19, 2024 22:40
…and FeedScreen

- Moved rating logic and concurrency-safe updates (Firestore transactions) into PostsViewModel.
- Removed direct rating calculations from FeedScreen, relying instead on ViewModel’s state and methods.
- Initialize and observe post ratings and user profiles in the ViewModel to ensure a single source of truth.
- Improved performance and stability by avoiding repeated rating initializations and ensuring atomic updates.
- Enhanced code maintainability and reduced UI complexity by centralizing business logic in the ViewModel.
@sonarqubecloud
Copy link

Copy link
Contributor

@rihabbelmekki rihabbelmekki left a comment

Choose a reason for hiding this comment

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

Great code! The changes correctly fix the rating state inconsistency issues by:

Removing the separate state management functions and bringing the logic back inline
Improving the profile state handling to ensure ratings are properly reinitialized when navigating back to the feed
Adding proper profile loading checks before initializing ratings

The code is now more robust and maintains consistent state across navigation. Tested and confirmed that ratings persist correctly when navigating between screens. Good to merge!

@mehdi-hamirifou mehdi-hamirifou merged commit 2966e2d into main Dec 20, 2024
3 checks passed
@mehdi-hamirifou mehdi-hamirifou deleted the fix-remove-zero-star-rating branch December 20, 2024 04:29
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.

Remove zero star rating

3 participants