Skip to content

Commit

Permalink
Remove team chain calculation from BambooHR converter + disable Bambo…
Browse files Browse the repository at this point in the history
…oHR acceptance test (#546)
  • Loading branch information
cjwooo authored Jun 24, 2022
1 parent edbc18e commit 15f77b4
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 27 deletions.
1 change: 1 addition & 0 deletions .github/workflows/skip-test-sources.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
agileaccelerator-source
azure-repos-source
azurepipeline-source
bamboohr-source
gitlab-ci-source
googlecalendar-source
datadog-source
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
import {AirbyteLogger, AirbyteRecord} from 'faros-airbyte-cdk';
import {AirbyteRecord} from 'faros-airbyte-cdk';
import {Utils} from 'faros-feeds-sdk';
import {intersection} from 'lodash';

import {DestinationModel, DestinationRecord, StreamContext} from '../converter';
import {BambooHRConverter} from './common';
import {User} from './models';

const ROOT_TEAM_ID = 'all_teams';

export class Users extends BambooHRConverter {
private readonly logger: AirbyteLogger = new AirbyteLogger();

readonly destinationModels: ReadonlyArray<DestinationModel> = [
'geo_Address',
'geo_Location',
Expand Down Expand Up @@ -133,7 +129,6 @@ export class Users extends BambooHRConverter {
name: `${this.employeeIdsToNames.get(uid)} Org`,
lead: {uid},
parentTeam: parentTeamId ? {uid: parentTeamId} : null,
teamChain: this.computeManagerChain(uid),
},
});
res.push({
Expand All @@ -146,25 +141,4 @@ export class Users extends BambooHRConverter {
}
return res;
}

private computeManagerChain(employeeId: string) {
let managerId = employeeId;
const managerChain = [];
const visited = new Set<string>();
do {
managerChain.push(managerId);
if (visited.has(managerId)) {
this.logger.warn(
`There is a cycle in the manager chain for ${employeeId}. Manager chain: ${managerChain}`
);
return [];
}
visited.add(managerId);
const nextManagerId = this.managers.get(managerId);
if (!nextManagerId) break;
managerId = nextManagerId;
} while (managerId);
managerChain.push(ROOT_TEAM_ID);
return managerChain;
}
}

0 comments on commit 15f77b4

Please sign in to comment.