From bf9f507f0f9817b888fbcd26c7521e1a2ca178d0 Mon Sep 17 00:00:00 2001 From: Agustin <agusr1999@gmail.com> Date: Fri, 22 Oct 2021 16:28:36 -0300 Subject: [PATCH] Parameter update minor fix and documentation update. --- src/Services/ParameterService.ts | 6 +++++- swagger.yaml | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Services/ParameterService.ts b/src/Services/ParameterService.ts index 85e69c0..8430a17 100644 --- a/src/Services/ParameterService.ts +++ b/src/Services/ParameterService.ts @@ -307,7 +307,11 @@ const updateExtraData = async (parameters: DefaultExtraDataDTO[]): Promise<void> if (ids.includes(extraDataIDs.minLowPrev)) { if (ids.includes(extraDataIDs.minModPrev) && ids.includes(extraDataIDs.minIntPrev)) { - await updatePercentage(parameters, total); + if (ids.length === 3) { + await updatePercentage(parameters, total); + } else { + throw new Error('Too many parameters sent'); + } } else { throw new Error('Missing parameter for update'); } diff --git a/swagger.yaml b/swagger.yaml index ebfacb1..b35eb72 100644 --- a/swagger.yaml +++ b/swagger.yaml @@ -104,7 +104,7 @@ paths: put: tags: - Parameters - summary: Update a certain parameter + summary: Update a certain parameter. The array should contain exactly one item, unless the parameters to be updated are a trio, in which case all three parameters should be included. requestBody: content: application/json: -- GitLab