diff --git a/packages/component-mts-package/src/MTS.js b/packages/component-mts-package/src/MTS.js index 5907e433d3efbc27e2c018829a8e87014bc1a05e..22d862896b71ffa81a67478a708a0dadcc262974 100644 --- a/packages/component-mts-package/src/MTS.js +++ b/packages/component-mts-package/src/MTS.js @@ -166,6 +166,12 @@ class MTS { ? 'no' : hasDataAvailability + const getQuestionMessage = (selection, message, defaultMessage) => { + if (selection === 'yes') { + return '' + } + return isEmpty(message) ? defaultMessage : message + } if (!isEmpty(hasConflicts)) { questions.push({ _attributes: { @@ -188,9 +194,11 @@ class MTS { _text: capitalize(dataAvailability), }, statement: { - _text: isEmpty(dataAvailabilityMessage) - ? 'The authors for this paper did not provide a data availability statement' - : dataAvailabilityMessage, + _text: getQuestionMessage( + dataAvailability, + dataAvailabilityMessage, + 'The authors for this paper did not provide a data availability statement', + ), }, }) } @@ -203,9 +211,11 @@ class MTS { _text: capitalize(funding), }, statement: { - _text: isEmpty(fundingMessage) - ? 'The authors for this paper did not provide a funding statement' - : fundingMessage, + _text: getQuestionMessage( + funding, + fundingMessage, + 'The authors for this paper did not provide a funding statement', + ), }, }) }