копирование есть
This commit is contained in:
@@ -53,6 +53,7 @@ interface IPortalEmployee {
|
||||
fio: string;
|
||||
email: string | null;
|
||||
position: string | null;
|
||||
company: string | null;
|
||||
}
|
||||
|
||||
async function getJson<T>(client: AadHttpClient, baseUrl: string, path: string): Promise<T> {
|
||||
@@ -112,11 +113,17 @@ export class PortalDictionaryClient {
|
||||
if (!x.email) return;
|
||||
const existing = byEmail.get(x.email);
|
||||
if (!existing) {
|
||||
byEmail.set(x.email, { fio: x.fio, email: x.email, position: x.position || '' });
|
||||
} else if (!existing.position && x.position) {
|
||||
// Один сотрудник — строка на каждый его отдел; должность могла найтись
|
||||
// не в первой из них.
|
||||
existing.position = x.position;
|
||||
byEmail.set(x.email, {
|
||||
fio: x.fio,
|
||||
email: x.email,
|
||||
position: x.position || '',
|
||||
company: x.company || ''
|
||||
});
|
||||
} else {
|
||||
// Один сотрудник — строка на каждый его отдел; должность и компания
|
||||
// могли найтись не в первой из них.
|
||||
if (!existing.position && x.position) existing.position = x.position;
|
||||
if (!existing.company && x.company) existing.company = x.company;
|
||||
}
|
||||
});
|
||||
return Array.from(byEmail.values());
|
||||
|
||||
Reference in New Issue
Block a user