This commit is contained in:
SepehrYahyaee
2026-06-03 12:23:30 +03:30
parent 2c810afcb6
commit 0b47e8789b
2 changed files with 273 additions and 89 deletions

View File

@@ -0,0 +1,42 @@
export function extractExpertNamesFromBlame(b: any): string[] {
const names = new Set<string>();
const add = (v: unknown) => {
if (typeof v === "string" && v.trim()) names.add(v.trim());
};
add(b?.workflow?.assignedForReviewBy?.actorName);
add(b?.workflow?.lockedBy?.actorName);
// History entries from expert actions
for (const h of b?.history ?? []) {
if (
h?.actor?.actorType === "field_expert" ||
h?.actor?.actorType === "damage_expert"
) {
add(h?.actor?.actorName);
}
}
return [...names];
}
export function extractExpertNamesFromClaim(c: any): string[] {
const names = new Set<string>();
const add = (v: unknown) => {
if (typeof v === "string" && v.trim()) names.add(v.trim());
};
add(c?.workflow?.assignedForReviewBy?.actorName);
add(c?.workflow?.lockedBy?.actorName);
// Evaluation snapshots
add(c?.evaluation?.damageExpertResend?.expertProfileSnapshot?.fullName);
add(c?.evaluation?.damageExpertReply?.expertProfileSnapshot?.fullName);
add(c?.evaluation?.damageExpertReplyFinal?.expertProfileSnapshot?.fullName);
add(c?.evaluation?.factorValidationExpertProfileSnapshot?.fullName);
add(c?.evaluation?.inPersonVisitExpertProfileSnapshot?.fullName);
return [...names];
}