feat: add support for RADIO field type in filtering logic by including textValue in agent field matching

This commit is contained in:
pradeepkumar
2026-04-15 23:45:12 +05:30
parent ef52858990
commit 678630fa8e
2 changed files with 15 additions and 1 deletions

View File

@@ -498,12 +498,17 @@ export class AgentsService {
select: {
agentProfileId: true,
jsonValue: true,
textValue: true,
},
});
const matchingIds = matchingValues
.filter((fv) => {
const jsonVal = fv.jsonValue as unknown;
// RADIO / SELECT values live in textValue (single string)
if (typeof fv.textValue === 'string' && fv.textValue) {
if (selectedValues.includes(fv.textValue)) return true;
}
if (!Array.isArray(jsonVal)) return false;
// Direct match (normalized option values stored in jsonVal)
if (selectedValues.some((sv) => jsonVal.includes(sv))) return true;
@@ -672,6 +677,10 @@ export class AgentsService {
const agentFieldValues = (agent.fieldValues || []) as any[];
const fieldMatch = agentFieldValues.some((fv: any) => {
if (fv.field?.slug !== filterSlug) return false;
// RADIO / SELECT values live in textValue
if (typeof fv.textValue === 'string' && fv.textValue) {
if (selectedValues.includes(fv.textValue)) return true;
}
const jsonVal = fv.jsonValue as unknown;
if (!Array.isArray(jsonVal)) return false;
// Direct match (normalized option values already stored in jsonVal)