This pull request introduces a new scoring algorithm for the getAllAttractionSites function in the attraction site controller. The purpose of this enhancement is to dynamically rank tourist attractions based on user preferences, independent of location.
Key Features
Rating Score:
Attractions receive points based on their average rating. Higher-rated attractions score more points.
Preference Score:
If the attraction's category matches the user's specified preferences (e.g., "Museum" or "Park"), the attraction gains additional points.
Nearby Restaurants Score:
Attractions are evaluated based on the average ratings of nearby restaurants. Attractions with higher-rated nearby restaurants receive more points.
Functionality Changes
The function now accepts query parameters for sorting (sortBy) and user preferences (preferences).
If no query parameters are provided, all attraction sites are returned without filtering.
If preferences are included, attractions are scored and sorted based on the three criteria mentioned above, allowing users to see the most relevant attractions according to their interests.
Testing
The endpoint has been tested using Postman to ensure that:
The scoring system works correctly with and without user preferences.
The response includes calculated scores for each attraction when preferences are provided.
Conclusion
This enhancement aims to provide a more personalized experience for users, helping them discover attractions that align with their interests and improving the overall functionality of the application.
Summary of Changes
This pull request introduces a new scoring algorithm for the
getAllAttractionSites
function in the attraction site controller. The purpose of this enhancement is to dynamically rank tourist attractions based on user preferences, independent of location.Key Features
Rating Score:
Preference Score:
Nearby Restaurants Score:
Functionality Changes
sortBy
) and user preferences (preferences
).Testing
Conclusion
This enhancement aims to provide a more personalized experience for users, helping them discover attractions that align with their interests and improving the overall functionality of the application.