From f47f0d61ca0f8f999ded36c79414b134beb772fe Mon Sep 17 00:00:00 2001 From: emmatveev Date: Sun, 24 Nov 2024 23:30:03 +0300 Subject: [PATCH] fix --- BaseLib/configurator.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/BaseLib/configurator.py b/BaseLib/configurator.py index aca5724..60ec220 100644 --- a/BaseLib/configurator.py +++ b/BaseLib/configurator.py @@ -32,8 +32,19 @@ def get_experiments(project, stage): response = get(URL_EXPERIMENTS, params={'project': project, 'stage': stage}) if response.status_code != 200: return [] - return response.json() - + data = response.json() + for exp in data: + if exp['condition'] == 'False': + exp['exp_type'] = 0 + elif exp['condition'] == 'user.is_superuser': + exp['exp_type'] = 1 + elif exp['condition'] == 'user.platform_staff': + exp['exp_type'] = 2 + elif exp['condition'] == 'True': + exp['exp_type'] = 3 + else: + exp['exp_type'] = 4 + return data def create_experiment(project, stage, name): post(URL_EXPERIMENTS, json={'project': project, 'stage': stage, 'name': name})