Skip to content

Add "Trending" - Filter to Blueprints on front page.#102

Open
MvBonin wants to merge 8 commits intogabriel-dehan:mainfrom
MvBonin:main
Open

Add "Trending" - Filter to Blueprints on front page.#102
MvBonin wants to merge 8 commits intogabriel-dehan:mainfrom
MvBonin:main

Conversation

@MvBonin
Copy link

@MvBonin MvBonin commented Jan 7, 2026

2nd try :)

I have added the "Trending"-Filter option to the front page in the blueprints section. adds #75
Since I don't have access to the production blueprints data it would be nice, if you could test it @gabriel-dehan and @mattr-.

It's basically this:

Calculate trending score for all blueprints (no time restriction)
Older blueprints can trend again if they get recent engagement

What counts:

  • Votes (likes): Recent votes (last 7 days) × 3.0, Total votes × 2.0
  • Copies/Downloads: Recent copies (last 7 days) × 1.5, Total copies × 1.0
  • Upload Time boost: 7 days = 30% boost, 30 days = 15% boost, older = no boost

Feel free to tweak the multipliers to your liking.

For adding the test I used AI and for the Chinese Translation I used a translation tool, hope it is right.

grafik

@MvBonin MvBonin marked this pull request as ready for review January 7, 2026 16:52
@MvBonin MvBonin marked this pull request as draft January 8, 2026 11:14
@MvBonin MvBonin marked this pull request as ready for review January 8, 2026 11:33
@MvBonin
Copy link
Author

MvBonin commented Jan 13, 2026

Hey @gabriel-dehan could you please approve the workflows for me to see if i need to fix anything? :)

@gabriel-dehan
Copy link
Owner

@MvBonin Just did! Sorry for the delay in reviewing, I'll try to do it this week-end, it's hard during the week with the work.

Copy link
Owner

@gabriel-dehan gabriel-dehan left a comment

Choose a reason for hiding this comment

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

Thanks for the PR!

I am worried about the performances and left a few comments.

Additionally I think it would be good to add new indexes to support this feature:

 add_index :votes, [:votable_type, :votable_id, :created_at]
 add_index :blueprint_usage_metrics, [:blueprint_id, :last_used_at]

@MvBonin
Copy link
Author

MvBonin commented Jan 19, 2026

Thanks for all your input!
Indeed this was not very performant but I think with your proposed changes it should be a lot faster.
I didn't have time yet to test with the data from the db dump though.

Also with this data it will be a bit easier to tweak the constants for trending blueprints, feel free to play around with them to your liking!

@MvBonin MvBonin requested a review from gabriel-dehan January 19, 2026 17:22
@MvBonin
Copy link
Author

MvBonin commented Jan 27, 2026

Hey @gabriel-dehan,

I think I changed everything that you requested and just fixed some rubocop errors.
Waiting for the workflows to run but then all should be fine, right?
Github tells me, there is 1 requested change still, but I cannot seem to find it or maybe it was the comment about indexes?

grafik

If you still want me to change something, I would love to do it.

@gabriel-dehan
Copy link
Owner

gabriel-dehan commented Jan 28, 2026

@MvBonin thanks a lot man! I just need to take some time to test the feature before merging but it looks all good to me!

Requested changes are not specific AFAIK it's about the PR as a whole when I did the first review. Don't worry about it I'll merge it once I am done testing

Copy link
Owner

@gabriel-dehan gabriel-dehan left a comment

Choose a reason for hiding this comment

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

Life being life and holidays being done it's been hard to find time to move forward with anything else than work, but I am approving this PR and will (soonish) test it on staging.

Thanks a lot for that, again.

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