Merge pull request 'fix' (#9) from config into dev

Reviewed-on: #9
This commit is contained in:
emmatveev 2024-11-24 23:32:45 +03:00
commit fa1b0c9700

View File

@ -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})