-
-
Notifications
You must be signed in to change notification settings - Fork 263
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
Add similar projects at the bottom of the project detail page. #5632
Conversation
683ef26
to
31e1949
Compare
31e1949
to
f6bb0a9
Compare
@Aadesh-Baral - can you also please add context on how the metadata fields were chosen to determine similarity between projects? |
To find similar projects, we analyzed the correlation between different project metadata fields and iterated through them. For instance, we observed that organizations tend to create similar projects based on their country and category. However, considering the organization for the similarity score led to the display of projects from the same organization, which affected the diversity of our displayed projects. Hence, we excluded organization as a field. Furthermore, we found some fields that didn't significantly contribute to our results, so we discarded them to enhance performance. |
Adding @HelNershingThapa to review frontend changes and @d-rita to review backend changes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When you click the related project card, the page should scroll to the top so that users feel like they are viewing another project when they navigate to the related project. Use the useFetch hook to fetch linked projects as well, making the component look cleaner. Other than that, LGTM, I've pushed with the requested changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Aadesh-Baral will the limit of the projects returned always be 4? We have a limit parameter that we don't actually give the user a chance to use in the endpoint
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested this, and it works as expected. The tests are good too. Overall, LGTM
Now the function to create project matrices is cached instead of the function that returns related projects. This change significantly improves our performance, as in cases where 'current_user' changes, the entire function would need to be re-run, causing a significant performance impact. By caching the 'create_project_matrix' function, we can optimize performance, as this function is a major component of calculating related projects and needs recalculation very rarely. |
8c12815
to
7616213
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested the basic functionality with @d-rita. Need to dig some more for edge cases @Aadesh-Baral
956ac34
to
8fa8975
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me @Aadesh-Baral
It is preferable to filter projects by completion when creating results rather than when creating project matrixes so that users can view related projects of completed projects and contribute to other projects that are similar to them.
Cache the function to generate project matrices instead of the function that returns related projects. This change significantly improves our performance, as in cases where 'current_user' changes, the entire function would need to be re-run, causing a significant performance impact. By caching the 'create_project_matrix' function, we can optimize performance, as this function is a major component of calculating related projects and needs recalculation very rarely.
When an error occurred while fetching related projects, add the message 'could not find related projects for this project.' This was done to ensure that when an error occurs in related projects, the entire project detail page is not impacted.
- Updated test_create_project_matrix_returns_project_matrix adding project_id on create_project_matrix to update cache - Mock get_similar_project_ids on test_get_related_projects_returns_related_projects - Remove test_only_non_completed_projects_are_returned as we no longer filter project by completion while fetching published projects see 178fdf1
--------------------------------------------------------------------- Since we are calculating project similarity rather than their relation, this change is done to align the wording with the logic that has been applied.
8fa8975
to
fe0029c
Compare
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
closes #5626
This PR adds similar projects at the bottom of the project detail page.
Implementation:
default_locale, difficulty, mapping_types, country, categories
How to test: