From 9fbdc45288531a8f4b7e90b2a875b8b34fc523b5 Mon Sep 17 00:00:00 2001 From: Matheus Lima Date: Fri, 26 Oct 2018 14:50:46 -0300 Subject: [PATCH] Fixing the installer skill to use a parameter to avoind hiding the to_install and to_remove fields. Also, fixing the logic to avoid the same skill being added to the to_install and to_remove fields multiple times --- .../v1/market-api/market_api/endpoints/skill_install.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/market/backend/v1/market-api/market_api/endpoints/skill_install.py b/market/backend/v1/market-api/market_api/endpoints/skill_install.py index 508b5ea1..8295d7a4 100644 --- a/market/backend/v1/market-api/market_api/endpoints/skill_install.py +++ b/market/backend/v1/market-api/market_api/endpoints/skill_install.py @@ -40,6 +40,9 @@ class SkillInstallEndpoint(SeleneEndpoint): service_request_headers = { 'Authorization': 'Bearer ' + self.tartarus_token } + service_request_parameters = { + 'disableHide': 'true' + } service_url = ( self.config['TARTARUS_BASE_URL'] + '/user/' + @@ -48,7 +51,8 @@ class SkillInstallEndpoint(SeleneEndpoint): ) user_service_response = requests.get( service_url, - headers=service_request_headers + headers=service_request_headers, + params=service_request_parameters ) if user_service_response.status_code != HTTPStatus.OK: self._check_for_service_errors(user_service_response) @@ -116,7 +120,8 @@ class SkillInstallEndpoint(SeleneEndpoint): raise ValueError(error_message.format(action, setting_section[0])) else: if action == 'add': - block.append({'name': skill_name}) + if not any(list(filter(lambda a: a['name'] == skill_name, block))): + block.append({'name': skill_name}) elif action == 'remove': block = list(filter(lambda x: x['name'] != skill_name, block)) else: