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

Support answer summaries or leaderboard (needed by code golf, wanted more generally) #224

Closed
cellio opened this issue Oct 25, 2020 · 4 comments · Fixed by #273
Closed

Support answer summaries or leaderboard (needed by code golf, wanted more generally) #224

cellio opened this issue Oct 25, 2020 · 4 comments · Fixed by #273
Labels
area: html/css/js Changes to front-end code area: ruby Changes to server-side code complexity: average Not particularly hard, not particularly trivial. priority: high status: in progress This is being worked on type: change request New feature or request

Comments

@cellio
Copy link
Member

cellio commented Oct 25, 2020

Code Golf needs a leaderboard for its challenges. (On SE they used a userscript that depends on the SE API. Our API isn't a swap-in replacement.) Specifically, the leaderboard appears at the bottom of the "question" (challenge), summarizing answers, ordered by byte count and also showing language. We have previously talked about adding answer summaries (using scores, not byte count), so ideally we will do something for CG that advances our general need too.

Possibilities:

  1. Add the concept of a "TOC" on a top-level post. The default TOC summarizes answers in score order as described in use cases and wireframes elsewhere. (Primitive wireframe sketch: https://www.figma.com/file/AwmzxwL9KNFfDHdnTHcrv1/expand-answers?node-id=0%3A1). The default TOC orders by score and displays upvotes, downvotes, first ~300 characters, author, last-modified date. So long as golf challenge answers follow a fixed format, length and language will appear in the summaries, but the list will be sorted by score not length. Per discussion in comments, this is the approach we'll take for now, and we'll come back to custom sorting later. Difficulty assessment is based on this decision.

  2. Introduce the idea of a custom TOC type, settable per post type per category, where admins can specify what to order by and what fields to display. Might require a custom answer type (to supply those fields). Vague idea for later.

  3. Make a new post type for challenges. A challenge is just like a question; a challenge answer has additional fields that need to be filled in (size and language), and the challenge uses that info to add a leaderboard (probably just size, language, link). We might need a "challenge answer" post type anyway to support Add network support #1, since otherwise the TOC code would have to parse answers. (I'm not fluent enough in the code to evaluate that trade-off.) Vague idea for later.

#1 is appealing because, ooh, generality, but it's also hard and I don't yet know if we have a third use case. (It's better to design general interfaces with more than one or two cases in mind.) #2 is probably easier except that we encode post type in a bunch of places -- URLs, category configuration, abilities, probably more -- so it might bite us in the end. On the third hand, maybe the post customization we need is only for answers, and a "golf answer" could be used with a (general) "question" post type, reducing the splash damage. On the fourth hand, I'd bet that'll break something else...

@cellio cellio added area: ruby Changes to server-side code area: html/css/js Changes to front-end code type: change request New feature or request priority: high complexity: unassessed Needs further developer investigation before complexity/feasibility can be determined. labels Oct 25, 2020
@ArtOfCode- ArtOfCode- added complexity: hard Will take significant time/effort/planning to resolve/fix/build correctly. and removed complexity: unassessed Needs further developer investigation before complexity/feasibility can be determined. labels Oct 25, 2020
@luap42
Copy link
Member

luap42 commented Nov 1, 2020

IMO the complexity is rather the other way round. The ToC/leaderboard needs some design considerations, but the UI component already exists and the functionality is just looping through all the answers one more time. This of course assumes, that we won’t sort by size but by score for now, which IIRC was okay to the CG folks as long as it is temporary.

Adding challenge post types would likely be more ... challenging? :) Post types appear in a lot of places and a lot of stuff isn’t really DRY-ed around them. I’d rather refactor the code to have one general post type agnostic route with some small per-type overrides than continuing the current path chosen for articles, which was mostly copying the old stuff and changing question to article everywhere and making other small changes.

@cellio
Copy link
Member Author

cellio commented Nov 1, 2020

I would love to refactor posts to all be posts, yes. I agree that adding more post types before we can do that would create lots of work and introduce bugs.

@luap42 what is the complexity of doing #1 but with default sort (scores) now? We would then need a plan for allowing other sorts, which could be done in a second phase. If CG challenge answers follow a convention of putting size and language first, then that info will show up in the TOC as the partial text of the answer, so that gets the visibility CG needs.

@luap42
Copy link
Member

luap42 commented Nov 1, 2020

Aye. So I thought. I think one of them commented, that vote order would be fine for now. Given that, the complexity is at the lower end of medium. Maybe a bit higher if you want to make the system smarter (e.g. show only when a per-site threshold of answers is reached).

I can start doing this on Tuesday; won’t hinder Abilities much. But if someone wants a relatively easy task, feel free to take it ;)

@cellio cellio added complexity: average Not particularly hard, not particularly trivial. and removed complexity: hard Will take significant time/effort/planning to resolve/fix/build correctly. labels Nov 1, 2020
@cellio
Copy link
Member Author

cellio commented Nov 1, 2020

I have updated the description based on this discussion. I added a possibility 0: TOC, sorts by score, shows content as previously designed which would show length and language if golf answers follow the format.

TOC should only appear if there are answers. Setting a minimum number in the code is good (so we can change it if we decide it looks dumb for just one). Making it a site setting like all the other thresholds would be better, but it's ok to do that part later.

@cellio cellio added the status: in progress This is being worked on label Nov 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: html/css/js Changes to front-end code area: ruby Changes to server-side code complexity: average Not particularly hard, not particularly trivial. priority: high status: in progress This is being worked on type: change request New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants