perf: lookup
Co-Authored-By: alifurkanstahl <180474740+alifurkanstahl@users.noreply.github.com>
This commit is contained in:
co-authored by
alifurkanstahl
parent
2376258f02
commit
7eae377c01
@@ -130,11 +130,11 @@ async def get_all_models(request, refresh: bool = False, user: UserModel = None)
|
||||
]
|
||||
models = models + arena_models
|
||||
|
||||
global_action_ids = [function.id for function in Functions.get_global_action_functions()]
|
||||
enabled_action_ids = [function.id for function in Functions.get_functions_by_type('action', active_only=True)]
|
||||
global_action_ids = {function.id for function in Functions.get_global_action_functions()}
|
||||
enabled_action_ids = {function.id for function in Functions.get_functions_by_type('action', active_only=True)}
|
||||
|
||||
global_filter_ids = [function.id for function in Functions.get_global_filter_functions()]
|
||||
enabled_filter_ids = [function.id for function in Functions.get_functions_by_type('filter', active_only=True)]
|
||||
global_filter_ids = {function.id for function in Functions.get_global_filter_functions()}
|
||||
enabled_filter_ids = {function.id for function in Functions.get_functions_by_type('filter', active_only=True)}
|
||||
|
||||
custom_models = Models.get_all_models()
|
||||
|
||||
@@ -328,14 +328,14 @@ async def get_all_models(request, refresh: bool = False, user: UserModel = None)
|
||||
for model in models:
|
||||
action_ids = [
|
||||
action_id
|
||||
for action_id in list(set(model.pop('action_ids', []) + global_action_ids))
|
||||
for action_id in set(model.pop('action_ids', [])) | global_action_ids
|
||||
if action_id in enabled_action_ids
|
||||
]
|
||||
action_ids.sort(key=lambda aid: (get_action_priority(aid), aid))
|
||||
|
||||
filter_ids = [
|
||||
filter_id
|
||||
for filter_id in list(set(model.pop('filter_ids', []) + global_filter_ids))
|
||||
for filter_id in set(model.pop('filter_ids', [])) | global_filter_ids
|
||||
if filter_id in enabled_filter_ids
|
||||
]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user