Skip to content

numeric ordering

Placeholder Benjamin Bearce requested to merge issue_1171 into develop

Description

Ordering was lexigraphical only due to a plugin called tablesort from src/static/js/ours/utils.js

Brief history and mental map:

  1. src/static/riot/competitions/detail/leaderboards.tag - hosts "#leaderboardTable#
  2. /src/templates/base.html imports https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.4.1/semantic.min.css
  3. https://semantic-ui.com/collections/table.html#sortable has a tabl type called "sortable"
  4. They have a note: image
  5. The this_javascript link takes you to a tablesort.js file. As it turns out we copy and pasted this in src/static/js/ours/utils.js. There you can see the link the aforementioned kylefox plugin.
  6. The compare function never determines what it's sorting and that could be strings or numbers. By forcing a decision to use numbers if indeed there are numbers we can correctly sort by floats or strings.

Issues this PR resolves

  • PR failed circleci but it was a dependency but in requirements.txt

A checklist for hand testing

  • Use below bundle with sample submissions to create a leaderboard that prioritizes the Score column as sorting column. When clicking any column, you should see the correct order:

Any relevant files for testing

template_v2_bundle.zip

Checklist

  • Code review by me
  • Hand tested by me
  • I'm proud of my work
  • Code review by reviewer
  • Hand tested by reviewer
  • CircleCi tests are passing
  • Ready to merge

Merge request reports

Loading