Skip to content

Conversation

@akhal3d96
Copy link
Contributor

No description provided.

Comment on lines 11 to 13
most_liked = user.functions.order(likes_count: :desc).first
most_commented = user.functions.order(comments_count: :desc).first
most_saved = user.functions.order(saves_count: :desc).first
Copy link
Owner

Choose a reason for hiding this comment

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

It seems we need also to pass the function we need to ignore here, as this is more functions except the current one.

Also it seems that if we ordered by likes_count + comments_count + saves_count that will give us also a good result, which is the most interacted functions first, the most popular functions for this user.

as you know, any one of these 3 lines can return nil which will miss up your line 15 and you'll have to do compact there so a single query on the database with the criteria and order will be better.

@akhal3d96 akhal3d96 requested a review from emad-elsaid June 7, 2020 02:08
@akhal3d96 akhal3d96 force-pushed the functions_recommendations branch 2 times, most recently from 5bac43f to 4c78be3 Compare June 11, 2020 22:43
@akhal3d96 akhal3d96 force-pushed the functions_recommendations branch from 4c78be3 to 3edfb9c Compare June 12, 2020 21:18
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.

2 participants