Autolab icon indicating copy to clipboard operation
Autolab copied to clipboard

Scoreboard Column Specification does not work if asc/desc is defined beyond third column

Open pcbouman-eur opened this issue 6 years ago • 0 comments

A colleague is currently implementing a scoreboard with six columns and ran into trouble when he added "asc": 1 to the json-definition of certain columns. Some experimenting suggests that this happens only for beyond column 3. This means the following json works fine:

{"scoreboard":[{"hdr":"1", "asc":1},{"hdr":"2", "asc":1},{"hdr":"3", "asc": 1},{"hdr":"4"},{"hdr":"5"},{"hdr":"6"}]}

while the following is ignored:

{"scoreboard":[{"hdr":"1", "asc":1},{"hdr":"2", "asc":1},{"hdr":"3", "asc": 1},{"hdr":"4", "asc" : 1},{"hdr":"5"},{"hdr":"6"}]}

The reason for this seems to be the condition that a 'asc' or 'desc' key is only accepted in columns with index smaller than three in /app/controllers/scoreboards_controller.rb, for reasons that were unclear to me: https://github.com/autolab/Autolab/blob/d914dc8f1e8110e887657b5eb51169f8adc153b3/app/controllers/scoreboards_controller.rb#L198

The main issue seems to be that sorting is done in the scoreboardOrderSubmissions method in the same file does a hard-coded sorting for three elements. Maybe it would be an idea to use a generale comparison, or add a warning to the colspec-page.

pcbouman-eur avatar Mar 20 '18 16:03 pcbouman-eur