The-Yak-Collective / yakcollective

The Yak Collective website & related automation.
17 stars 9 forks source link

Randomize member page? #69

Closed vgururao closed 4 years ago

vgururao commented 4 years ago

The member directory should be sortable by alphabetical order as currently shown, but that should not be the default view since it arbitrarily over-exposes some members and under-exposes others. Default sort order should be some flavor of random, so at each visit you see a different few people above the fold. Other sort orders can be added (alphabetical, chronological by join date, project contribution karma...). Potentially integrate this idea with the "featured" member thing... where the featured member is also the random top member or something.

tilnow commented 4 years ago

is it enough/ok that the "random" order be fixed at build time? is it acceptable if we just start member list at some random location and then go in order?

just asking, not yet sure how to implement this. though i think i would build a new list members_random from the existing list in members, in member-list.html

vgururao commented 4 years ago

Yes I think that will all work

On Sunday, August 2, 2020, tilnow notifications@github.com wrote:

is it enough/ok that the "random" order be fixed at build time? is it acceptable if we just start member list at some random location and then go in order?

just asking, not yet sure how to implement this. though i think i would build a new list members_random from the existing list in members, in member-list.html

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/The-Yak-Collective/yakcollective/issues/69#issuecomment-667711062, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAGMFW3S7E2YWU2SQOIVS5LR6WYZTANCNFSM4PR6WFTA .

tilnow commented 4 years ago

looks like jekyll has a built in filter called sample that does it. see also https://stackoverflow.com/questions/27179385/how-do-i-shuffle-the-order-of-an-array-in-jekyll

necopinus commented 4 years ago

In particular: https://stackoverflow.com/a/59833695

Cut-and-paste between lines 10 and 11 in _layouts/member-list.html, tweak some variable names, done.

...And I'm realizing that the entire approach with taking the modulo of the date that we've use elsewhere is way too complicated; we should just be piping the array we want to randomize to sample, and then piping the output of that to first to strip the "array-ness" off of the resulting single-element array.

tilnow commented 4 years ago

the reason why i decided not to change that is that i now generate the "featured_one" as a number. that number is part of the site data and can be used all over the place.

tilnow commented 4 years ago

i see you did not push (neither did i yet - lets decide tonight). here is my code: `--- layout: minimal

Members

{{ content }}
#change starts here {% assign num_members = site.members | size %} {% assign membs = site.members | sample: num_members %} {% for member in membs %} #and ends here {% if member.date <= site.time or site.future == true %} {% include member-card.html %} {% endif %} {% endfor %}

`

tilnow commented 4 years ago

pushed. works. see at https://inspiring-villani-8898ca.netlify.app/members/