-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ASAP-507 Engagement CSV Export (#4357)
* ASAP-507 Engagement CSV Export * fix lint
- Loading branch information
Showing
6 changed files
with
97 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
apps/crn-frontend/src/analytics/engagement/__tests__/export.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { EngagementDataObject } from '@asap-hub/model'; | ||
import { engagementToCSV } from '../export'; | ||
|
||
describe('engagementToCSV', () => { | ||
const data: EngagementDataObject = { | ||
id: '1', | ||
name: 'Test Team', | ||
inactiveSince: null, | ||
memberCount: 1, | ||
eventCount: 4, | ||
totalSpeakerCount: 3, | ||
uniqueAllRolesCount: 3, | ||
uniqueAllRolesCountPercentage: 100, | ||
uniqueKeyPersonnelCount: 2, | ||
uniqueKeyPersonnelCountPercentage: 67, | ||
}; | ||
|
||
it('exports engagement data', () => { | ||
expect(engagementToCSV(data)).toEqual({ | ||
Team: 'Test Team', | ||
'Team Status': 'Active', | ||
'Inactive Since': '', | ||
Members: 1, | ||
Events: 4, | ||
'Total Speakers': 3, | ||
'Unique Speakers (All Roles): Value': 3, | ||
'Unique Speakers (All Roles): Percentage': '100%', | ||
'Unique Speakers (Key Personnel): Value': 2, | ||
'Unique Speakers (Key Personnel): Percentage': '67%', | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { EngagementDataObject } from '@asap-hub/model'; | ||
|
||
export const engagementToCSV = (data: EngagementDataObject) => ({ | ||
Team: data.name, | ||
'Team Status': data.inactiveSince ? 'Inactive' : 'Active', | ||
'Inactive Since': data.inactiveSince ? data.inactiveSince.split('T')[0] : '', | ||
Members: data.memberCount, | ||
Events: data.eventCount, | ||
'Total Speakers': data.totalSpeakerCount, | ||
'Unique Speakers (All Roles): Value': data.uniqueAllRolesCount, | ||
'Unique Speakers (All Roles): Percentage': `${data.uniqueAllRolesCountPercentage}%`, | ||
'Unique Speakers (Key Personnel): Value': data.uniqueKeyPersonnelCount, | ||
'Unique Speakers (Key Personnel): Percentage': `${data.uniqueKeyPersonnelCountPercentage}%`, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters