fix leaderboard through id not date
This commit is contained in:
1 parent
6ed0f69050
commit
8b74f277b2
2 files changed
+6
-8
No files matched your search
@@ -106,13 +106,15 @@ def leaderboard() -> str:
|
|||||||
|
|
||||||
session_ids = [session.session_id for session in ordered_sessions]
|
session_ids = [session.session_id for session in ordered_sessions]
|
||||||
selected_session_id = request.args.get("through_session", "").strip()
|
selected_session_id = request.args.get("through_session", "").strip()
|
||||||
|
label = ""
|
||||||
|
|
||||||
if session_ids:
|
if session_ids:
|
||||||
if selected_session_id in session_ids:
|
if selected_session_id in session_ids:
|
||||||
cutoff_index = session_ids.index(selected_session_id)
|
cutoff_index = session_ids.index(selected_session_id)
|
||||||
else:
|
else:
|
||||||
cutoff_index = len(session_ids) - 1
|
cutoff_index = len(session_ids) - 1
|
||||||
selected_session = session_ids[cutoff_index]
|
selected_session = ordered_sessions[cutoff_index]
|
||||||
|
label = session_label(selected_session)
|
||||||
|
|
||||||
filtered_sessions = ordered_sessions[: cutoff_index + 1]
|
filtered_sessions = ordered_sessions[: cutoff_index + 1]
|
||||||
previous_sessions = ordered_sessions[:cutoff_index]
|
previous_sessions = ordered_sessions[:cutoff_index]
|
||||||
@@ -133,12 +135,8 @@ def leaderboard() -> str:
|
|||||||
total_session_count=len(all_sessions),
|
total_session_count=len(all_sessions),
|
||||||
chart_data=chart_data,
|
chart_data=chart_data,
|
||||||
available_sessions=all_sessions,
|
available_sessions=all_sessions,
|
||||||
selected_session_date=selected_session_id,
|
selected_session_id=selected_session_id,
|
||||||
selected_session_label=(
|
selected_session_label=(label if selected_session_id else "Latest session"),
|
||||||
safe_date_label(selected_session_id)
|
|
||||||
if selected_session_id
|
|
||||||
else "Latest session"
|
|
||||||
),
|
|
||||||
session_label=session_label,
|
session_label=session_label,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -49,7 +49,7 @@
|
|||||||
<form method="get" class="session-filter-form">
|
<form method="get" class="session-filter-form">
|
||||||
<label for="through_session" class="session-filter-label">Through session</label>
|
<label for="through_session" class="session-filter-label">Through session</label>
|
||||||
<select id="through_session" name="through_session" class="session-filter-select" onchange="this.form.submit()">
|
<select id="through_session" name="through_session" class="session-filter-select" onchange="this.form.submit()">
|
||||||
<option value="" {% if not selected_session_date %}selected{% endif %}>Latest session</option>
|
<option value="" {% if not selected_session_id %}selected{% endif %}>Latest session</option>
|
||||||
{% for session in available_sessions %}
|
{% for session in available_sessions %}
|
||||||
<option value="{{ session.session_id }}" {% if selected_session_id == session.session_id %}selected{% endif %}>{{ session_label(session) }}</option>
|
<option value="{{ session.session_id }}" {% if selected_session_id == session.session_id %}selected{% endif %}>{{ session_label(session) }}</option>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|||||||
Reference in new issue
Block a user