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

Add 'submission_id' and 'Kill Sub' columns in New submissions leaderboard #589

Merged
merged 5 commits into from
Sep 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file added pytest.ini
Empty file.
17 changes: 16 additions & 1 deletion ramp-database/ramp_database/tools/leaderboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -427,12 +427,19 @@ def get_leaderboard(
columns = [
"team",
"submission",
"id",
"submitted at (UTC)",
"state",
"waiting list",
]
else:
columns = ["team", "submission", "submitted at (UTC)", "error"]
columns = [
"team",
"submission",
"id",
"submitted at (UTC)",
"error",
]

# we rely on the zip function ignore the submission state if the error
# column was not appended
Expand All @@ -444,6 +451,7 @@ def get_leaderboard(
[
sub.event_team.team.name,
sub.name_with_link,
sub.id,
pd.Timestamp(sub.submission_timestamp),
(
sub.state_with_link
Expand All @@ -461,6 +469,13 @@ def get_leaderboard(
for sub in submissions
]
df = pd.DataFrame(data, columns=columns)
if leaderboard_type == "new":

def create_button(cell_value):
return f"<button onclick=\"alert(('You killed ' \
+ 'submission {cell_value}!'))\">{cell_value}</button>"

df["Stop"] = df["id"].apply(lambda x: create_button(x))
else:
# make some extra filtering
submissions = [sub for sub in submissions if sub.is_public_leaderboard]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,7 @@ def test_get_leaderboard(session_toy_db):
assert (
"""<th>team</th>
<th>submission</th>
<th>id</th>
<th>submitted at (UTC)</th>
<th>error</th>"""
in leaderboard_failed
Expand Down
Loading