-
Notifications
You must be signed in to change notification settings - Fork 33
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
Conversation
2a9a5ee
to
0902069
Compare
@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. |
f426255
to
dedb0a8
Compare
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.
dedb0a8
to
a4c142c
Compare
Your screenshot is descending by number of devs. The pledge amounts are static in the test data, so that results in ascending amounts! |
I’ll remove the test data — we don’t need it anymore, so it will just add confusion. |
Hah! :) In that case ... |
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 nothidden
. 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.