fix: clarify complementary field diagnostics and target exact QA controls
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { useEffect, useRef, useState } from 'react';
|
||||
import {
|
||||
correctionFieldHints,
|
||||
correctionGroupMatches,
|
||||
fieldLabelMatches,
|
||||
revealCorrectionTarget,
|
||||
} from '@/lib/field-corrections';
|
||||
@@ -101,14 +102,17 @@ export default function PortalCorrections() {
|
||||
node.textContent?.replace(/\s+/g, ' ').trim() ||
|
||||
'';
|
||||
if (!message) continue;
|
||||
const hints = correctionFieldHints(message);
|
||||
const hints = correctionFieldHints(
|
||||
message,
|
||||
names.map(({ label }) => label),
|
||||
);
|
||||
const matches = names.filter(
|
||||
({ label }) =>
|
||||
label && hints.some((h) => fieldLabelMatches(label, h)),
|
||||
);
|
||||
// Restrict explicit product/parcel/milestone/personnel diagnostics to the matching real group, if present.
|
||||
const index =
|
||||
/(?:produto|parcela|marco|função|necessidade)\s+(\d+)/i.exec(
|
||||
/(?:produto|parcela|marco|função|necessidade|segmento)\s+(\d+)/i.exec(
|
||||
message,
|
||||
);
|
||||
const indexed = index
|
||||
@@ -120,10 +124,7 @@ export default function PortalCorrections() {
|
||||
group?.getAttribute('aria-label') ||
|
||||
group?.querySelector('legend')?.textContent ||
|
||||
'';
|
||||
return new RegExp(
|
||||
`(?:produto|parcela|marco|função|necessidade)\\s+${index[1]}\\b`,
|
||||
'i',
|
||||
).test(name);
|
||||
return correctionGroupMatches(message, name);
|
||||
})
|
||||
: [];
|
||||
add(
|
||||
|
||||
Reference in New Issue
Block a user