feat: add support for RADIO field type in filtering logic by including textValue in agent field matching
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user