Skip to content

Commit

Permalink
[tools] Polish team export
Browse files Browse the repository at this point in the history
  • Loading branch information
oliviertassinari committed Feb 2, 2025
1 parent 1023fee commit 0b51989
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 3 deletions.
2 changes: 1 addition & 1 deletion tools-public/toolpad/pages/muicomabout/page.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ spec:
headerName: Name
- field: title
type: string
width: 246
width: 260
headerName: Title
- field: about
type: string
Expand Down
31 changes: 29 additions & 2 deletions tools-public/toolpad/resources/queryAbout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@ function flip(data) {

const countryFix = {
'Macedonia, the former Yugoslav Republic of': 'North Macedonia',
'United Kingdom': 'UK',
'United States': 'US',
};

const cityFix = {
'Greater London': 'London',
'New York City': 'New York',
'Islamabad Capital Territory': 'Islamabad',
};

export async function queryAbout() {
Expand All @@ -24,7 +32,9 @@ export async function queryAbout() {
fields: [
'root.displayName', // 'root.fullName', is the legal name, use the preferred name instead.
'address.country',
'work.custom.field_1680187492413',
'address.city',
'address.customColumns.column_1738498855264',
'work.title',
'work.tenureDurationYears',
'about.custom.field_1682954415714',
Expand Down Expand Up @@ -52,16 +62,33 @@ export async function queryAbout() {
const countries = await countriesRes.json();
// Fix country label
countries.cz = 'Czech Republic';
countries.us = 'US';
countries.gb = 'UK';
const countryToISO = flip(countries);

return data.employees
.sort((a, b) => parseFloat(b.work.tenureDurationYears) - parseFloat(a.work.tenureDurationYears))
.map((employee) => {
const country = countryFix[employee.address.country] || employee.address.country;
const city = cityFix[employee.address.city] || employee.address.city;
const customCity = employee.address.customColumns?.column_1738498855264;
const teams = employee.work.custom.field_1680187492413.split(',');
let team = teams[0];
if (teams.includes('Core')) {
team = 'Core';
}
if (teams.includes('MUI')) {
team = 'MUI';
}
let location = `${customCity ?? city}, ${country}`;
// e.g. Hong Kong
if (city === country) {
location = city;
}
return {
name: employee.displayName,
title: employee.work.title,
location: `${employee.address.city}, ${country}`,
title: team === 'MUI' ? employee.work.title : `${employee.work.title}${team}`,
location,
locationCountry: countryToISO[country],
about: employee.about?.custom?.field_1690557141686,
twitter: employee.about?.socialData?.twitter?.replace('https://www.twitter.com/', ''),
Expand Down

0 comments on commit 0b51989

Please sign in to comment.