diff options
author | Alejandro Sirgo Rica <asirgo@soleta.eu> | 2024-11-28 16:35:55 +0100 |
---|---|---|
committer | Alejandro Sirgo Rica <asirgo@soleta.eu> | 2024-11-28 16:35:55 +0100 |
commit | a353cbcaa151c3f156ed7a068adea3842fac3261 (patch) | |
tree | c15095eaab861b3a62ad912337364d58facb4e61 /ogcp | |
parent | 76fe1b775a2fdad4ee7b8d04f2a71778f693d8e4 (diff) |
views: show correct live when the most used live is default
Use the correct livedir when the most used live is "ogLive"
Diffstat (limited to 'ogcp')
-rw-r--r-- | ogcp/views.py | 8 |
1 files 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 |