refactor: restrict agent specializations to about_me_expertise field only

This commit is contained in:
pradeepkumar
2026-04-17 08:12:38 +05:30
parent 8dafe73425
commit 0a241dd8c4

View File

@@ -153,21 +153,12 @@ class AgentProfile {
} }
/// Get specializations / expertise from field values. /// Get specializations / expertise from field values.
/// Matches web's getExpertiseTags slugs exactly. /// Strictly reads about_me_expertise only (matches web + admin filter source).
List<String> get specializations { List<String> get specializations {
final tags = <String>[]; final tags = <String>[];
// Must match web's expertiseFieldSlugs exactly (exact match, not contains)
const expertiseSlugs = [
'about_me_expertise',
'expertise_areas',
'specializations',
'areas_of_expertise',
'expertise',
];
for (final fv in fieldValues) { for (final fv in fieldValues) {
final slug = fv.fieldSlug.toLowerCase(); if (fv.fieldSlug.toLowerCase() != 'about_me_expertise') continue;
if (!expertiseSlugs.contains(slug)) continue;
if (fv.jsonValue is List) { if (fv.jsonValue is List) {
for (final v in (fv.jsonValue as List)) { for (final v in (fv.jsonValue as List)) {
@@ -187,16 +178,6 @@ class AgentProfile {
} }
} }
// Add from legacy specializations array
for (final spec in legacySpecializations) {
if (spec.isNotEmpty && !tags.contains(spec)) tags.add(spec);
}
// Add from languages array
for (final lang in languages) {
if (lang.isNotEmpty && !tags.contains(lang)) tags.add(lang);
}
return tags; return tags;
} }