Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 7 additions & 14 deletions src/rescoring.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
}

Expand Down Expand Up @@ -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={{
Expand Down Expand Up @@ -3442,7 +3440,7 @@ const Rescore = ({
Apply Rescoring
</Button>

const customRescoringsWithoutComment = rescorings.filter(rescoringNeedsComment)
const customRescoringsWithoutComment = rescorings.filter(r => rescoringNeedsComment(r, true))
Comment thread
zkdev marked this conversation as resolved.

if (customRescoringsWithoutComment.length > 0) return <Tooltip
title={
Expand Down Expand Up @@ -3659,14 +3657,9 @@ const RescoringModal = ({
}, [setSprints, rescoringsForType])

const allowedRescorings = filteredRescorings?.filter((rescoring) => {
// 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
Expand Down Expand Up @@ -3863,7 +3856,7 @@ const RescoringModal = ({
filteredOutRescoringsLength > 0 && <Tooltip
title={
`${filteredOutRescoringsLength} ${pluralise('rescoring', filteredOutRescoringsLength, 'is', 'are')}
filtered out or the categorisation did not change`
filtered out`
}
>
<InfoOutlinedIcon sx={{ height: '1rem' }}/>
Expand Down
Loading