From a353cbcaa151c3f156ed7a068adea3842fac3261 Mon Sep 17 00:00:00 2001 From: Alejandro Sirgo Rica Date: Thu, 28 Nov 2024 16:35:55 +0100 Subject: views: show correct live when the most used live is default Use the correct livedir when the most used live is "ogLive" --- ogcp/views.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/ogcp/views.py b/ogcp/views.py index a583dfa..6b3815c 100644 --- a/ogcp/views.py +++ b/ogcp/views.py @@ -2512,6 +2512,12 @@ def action_oglive(): oglive_list = r.json()['oglive'] most_used_live = max(oglives_set, key=lambda l: len(oglives_set[l])) + default_idx = int(r.json()['default']) + default_oglive_dir = oglive_list[default_idx].get('directory') + + if most_used_live == OG_CLIENT_DEFAULT_LIVEDIR: + most_used_live = default_oglive_dir + available_oglives = [] for oglive in oglive_list: live_entry = (oglive.get('directory'), oglive.get('directory')) @@ -2520,8 +2526,6 @@ def action_oglive(): else: available_oglives.append(live_entry) - default_idx = int(r.json()['default']) - default_oglive_dir = oglive_list[default_idx].get('directory') available_oglives.append(('default', f'ogLive ({default_oglive_dir})')) form.oglive.choices = available_oglives -- cgit v1.2.3-18-g5258