diff --git a/src/rescoring.js b/src/rescoring.js index 93a0386..a855f30 100644 --- a/src/rescoring.js +++ b/src/rescoring.js @@ -169,13 +169,11 @@ const rescoringIdentity = (rescoring) => { } -const rescoringNeedsComment = (rescoring) => { +const rescoringNeedsComment = (rescoring, isSelected = true) => { return ( rescoring.matching_rules.includes(META_RESCORING_RULES.CUSTOM_RESCORING) - && ( - rescoring.severity !== rescoring.originalSeverityProposal - || rescoring.due_date !== rescoring.originalDueDate - ) && !rescoring.comment + && !rescoring.comment + && isSelected ) } @@ -2671,7 +2669,7 @@ const RescoringContentTableRow = ({ defaultValue={rescoring.comment} onChange={(e) => delayRescoringUpdate({comment: e.target.value})} onClick={(e) => e.stopPropagation()} - error={rescoringNeedsComment(rescoring)} + error={rescoringNeedsComment(rescoring, Boolean(selectedRescorings.find((r) => rescoringIdentity(r) === rescoringIdentity(rescoring))))} size='small' maxRows={4} InputProps={{ @@ -3442,7 +3440,7 @@ const Rescore = ({ Apply Rescoring - const customRescoringsWithoutComment = rescorings.filter(rescoringNeedsComment) + const customRescoringsWithoutComment = rescorings.filter(r => rescoringNeedsComment(r, true)) if (customRescoringsWithoutComment.length > 0) return { - // only rescorings are allowed iff their severity has changed OR they allow a custom due date - // input and the due date has changed + // only rescorings are allowed iff they are selected and not filtered out return ( selectedRescorings.find((r) => rescoringIdentity(r) === rescoringIdentity(rescoring)) - && ( - rescoring.severity !== categoriseRescoringProposal({rescoring, findingCfg}).id - || rescoring.due_date !== rescoring.originalDueDate - ) ) }) const filteredOutRescoringsLength = filteredRescorings ? selectedRescorings.length - allowedRescorings.length : 0 @@ -3863,7 +3856,7 @@ const RescoringModal = ({ filteredOutRescoringsLength > 0 &&