Skip to content
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

Randomise homepage members #104

Merged
merged 3 commits into from
Sep 13, 2024
Merged

Randomise homepage members #104

merged 3 commits into from
Sep 13, 2024

Conversation

vladh
Copy link
Member

@vladh vladh commented Sep 11, 2024

Here's the approach I took. The list of members is randomised serverside for good measure. A row is created in the MiniLeaderboard table for each member, but only the first 5 members are not hidden. This increases network payload, but only marginally. Then, if Javascript is enabled, some Javascript code runs that calculates a set of 5 new indices of members to be shown. The appropriate members are then hidden/shown. This happens so quickly that it's unlikely to cause flashing because of a delay in executing JS, and it also gracefully degrades when JS is disabled, with members then being randomised on every build.

@chadwhitacre
Copy link
Contributor

The heading is no longer accurate. How about "Some Member Companies"?

Also we need to balance the two goals of giving all members airtime with putting our best foot forward for site visitors. I think we do this best by weighting the selection based on developer count. For today this means we should always include Sentry in the selection, plus four others. We can make it more complicated as we get more companies in larger buckets (how long until we have multiple companies larger than Sentry?).

image

@vladh
Copy link
Member Author

vladh commented Sep 13, 2024

@chadwhitacre Okay, here's a new strategy, which I think meets your requirements, but also is very fast and non-network-intensive.

When Javascript is off, companies are sorted by descending number of devs. When Javascript is on, the first company is always the biggest one, then each subsequent company in the sorted list has a 50% chance of getting skipped, and this is carried out until 5 companies are chosen. This means that predominantly large companies will be shown, but everyone has a chance to get shown.

When Javascript is off, companies are sorted by descending number of
devs. When Javascript is on, the first company is always the biggest
one, then each subsequent company in the sorted list has a 50% chance of
getting skipped, and this is carried out until 5 companies are chosen.
This means that predominantly large companies will be shown, but
everyone has a chance to get shown.
@chadwhitacre
Copy link
Contributor

Love the algo, thank you. Did you intend asc tho?

image image

@vladh
Copy link
Member Author

vladh commented Sep 13, 2024

Your screenshot is descending by number of devs. The pledge amounts are static in the test data, so that results in ascending amounts!

@vladh
Copy link
Member Author

vladh commented Sep 13, 2024

I’ll remove the test data — we don’t need it anymore, so it will just add confusion.

@chadwhitacre
Copy link
Contributor

Your screenshot is descending by number of devs.

Hah! :) In that case ...

@chadwhitacre chadwhitacre merged commit fafd198 into main Sep 13, 2024
3 checks passed
@chadwhitacre chadwhitacre deleted the vladh/randomize-members branch September 13, 2024 19:48
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