summaryrefslogtreecommitdiffstats
path: root/ogcp/views.py
diff options
context:
space:
mode:
authorAlejandro Sirgo Rica <asirgo@soleta.eu>2024-10-25 13:07:07 +0200
committerAlejandro Sirgo Rica <asirgo@soleta.eu>2024-10-25 13:10:01 +0200
commit9c7a687d56031df8ff2ae94f608fda98fdc6c464 (patch)
tree46fd4f1815ec91aa9317f79d12171771cc5ca6f1 /ogcp/views.py
parent270089983abfaf6c7f98c16512c74c7f6093abb1 (diff)
views: select the most used oglive in action/ogliveHEADmaster
Set the most used oglive as the first element of the <select> form component containing the list of available oglives.
Diffstat (limited to 'ogcp/views.py')
-rw-r--r--ogcp/views.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/ogcp/views.py b/ogcp/views.py
index d22cc23..d6fc67c 100644
--- a/ogcp/views.py
+++ b/ogcp/views.py
@@ -2475,9 +2475,14 @@ def action_oglive():
oglive_list = r.json()['oglive']
+ most_used_live = max(oglives_set, key=lambda l: len(oglives_set[l]))
available_oglives = []
for oglive in oglive_list:
- available_oglives.append((oglive.get('directory'), oglive.get('directory')))
+ live_entry = (oglive.get('directory'), oglive.get('directory'))
+ if oglive.get('directory') == most_used_live:
+ available_oglives.insert(0, live_entry)
+ else:
+ available_oglives.append(live_entry)
default_idx = int(r.json()['default'])
default_oglive_dir = oglive_list[default_idx].get('directory')