INGInious / INGInious/INGInious
Scoreboard option for top-N only
- Dominant language
- Python
- Stars
- 241
- Forks
- 151
- Avg merge
- 5d 15h
- Merged PRs (30d)
- 5
Description
It would be nice to have a top-N scoreboard where only the top submissions are displayed instead of the whole scoreboard. This could be implemented with a simple option `topn` in each scoreboard definition in `course.yaml`.
Possible implementation (I can submit a proper pull request when I have time):
```
diff --git a/inginious/frontend/webapp/plugins/scoreboard/__init__.py b/inginious/frontend/webapp/plugins/scoreboard/__init__.py
index 5c9005b3..0b5fdacb 100644
--- a/inginious/frontend/webapp/plugins/scoreboard/__init__.py
+++ b/inginious/frontend/webapp/plugins/scoreboard/__init__.py
@@ -53,6 +53,7 @@ class ScoreBoard(INGIniousAuthPage):
scoreboard_name = scoreboards[scoreboardid]["name"]
scoreboard_content = scoreboards[scoreboardid]["content"]
scoreboard_reverse = bool(scoreboards[scoreboardid].get('reverse', False))
+ scoreboard_topn = int(scoreboards[scoreboardid].get('topn', 0))
except:
raise web.notfound()
@@ -121,12 +122,16 @@ class ScoreBoard(INGIniousAuthPage):
solved = 0
for taskid, coef in scoreboard_content.items():
if taskid in val:
+ # This could be non-numeric
total += val[taskid]*coef
solved += 1
overall_result_per_user[key] = {"total": total, "solved": solved}
sorted_users = list(overall_result_per_user.keys())
sorted_users = sorted(sorted_users, key=sort_func(overall_result_per_user, scoreboard_reverse))
+ if scoreboard_topn > 0:
+ sorted_users = sorted_users[0:scoreboard_topn]
+
# Compute table
table = []
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.