-
Notifications
You must be signed in to change notification settings - Fork 165
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
Improve more projects section #1020
Conversation
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.
.
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.
LGTM 🚀
the code looks good. Still need to manually test the PR |
88c9daf
to
3c6a3ce
Compare
pre-commit checks failed ❌❌❌ |
* create views and utils methods to recommend projects * create api function to receive recommended projects in the frontend * modify project filtering * refactor recommend projects function Issue: #1013 Signed-off-by: Ndibe Raymond Olisaemeka <rolisaemeka-ctr@wikimedia.org>
3c6a3ce
to
7ce8ea5
Compare
All pre-commit checks passed ✅✅✅ |
* create views and utils methods to recommend projects * create api function to receive recommended projects in the frontend * modify project filtering * refactor recommend projects function Issue: #1013 Signed-off-by: Ndibe Raymond Olisaemeka <rolisaemeka-ctr@wikimedia.org> Co-authored-by: Ndibe Raymond Olisaemeka <rolisaemeka-ctr@wikimedia.org>
Summary
'More Projects' section used to show the projects of the same user instead of showing similar projects from any user. With this PR, this section sends a request to the backend with the current project's id and retrieves 3 recommended projects depending on the project's categories.
Closes #1013
The changes in backend is adapted from @anthonycruzmacedo 's code in #458
Changes
Frontend
projects/${id}/recommend/
getMoreProjects
functionprojectDetails.jsx
usesgetMoreProjects
to render the recommended projectsBackend
'<uuid:pk>/recommend/'
url is used to recommend projectsProjectRecommendAPIView
class returns 3 recommended projectsrecommend_projects
function handles the logic to determine the 3 projects by checking the projects with the same category/categories, and show the most liked projects if there's none.Screenshots
Before
After
Update
With the updated function, the projects are filtered based on their title, tags and categories. When doing title check, the project title is converted into an array of strings and each word is mapped. If any of the words are found in other titles, the project is appended. I will refer to these projects with 'similar title' in this PR.
First loop is done with the similar titled projects, looking for:
Second loop looks for projects with:
Third loop looks for the most liked projects