Skip to content

Commit

Permalink
feat: Updated leaderboard data table to use new API endpoint.
Browse files Browse the repository at this point in the history
  • Loading branch information
saleem-latif committed Sep 25, 2024
1 parent 045eefb commit 9ba101e
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 223 deletions.
119 changes: 0 additions & 119 deletions src/components/AdvanceAnalyticsV2/DownloadCSV.jsx

This file was deleted.

4 changes: 2 additions & 2 deletions src/components/AdvanceAnalyticsV2/data/hooks.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ const mockAnalyticsCompletionsChartsData = {
const mockAnalyticsLeaderboardTableData = [
{
email: '[email protected]',
dailySessions: 243,
sessionCount: 243,
learningTimeSeconds: 1111,
learningTimeHours: 3.4,
averageSessionLength: 1.6,
courseCompletions: 4,
courseCompletionCount: 4,
},
];

Expand Down
2 changes: 1 addition & 1 deletion src/components/AdvanceAnalyticsV2/tabs/AnalyticsTable.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const AnalyticsTable = ({
}) => {
const intl = useIntl();
const [currentPage, setCurrentPage] = useState(0);
const pageSize = 50;
const pageSize = 20;

const {
isFetching, data,
Expand Down
4 changes: 2 additions & 2 deletions src/components/AdvanceAnalyticsV2/tabs/Leaderboard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ const Leaderboard = ({ startDate, endDate, enterpriseId }) => {
description: 'Label for the daily sessions column in the leaderboard table',

}),
accessor: 'dailySessions',
accessor: 'sessionCount',
},
{
Header: intl.formatMessage({
Expand All @@ -67,7 +67,7 @@ const Leaderboard = ({ startDate, endDate, enterpriseId }) => {
defaultMessage: 'Course Completions',
description: 'Label for the course completions column in the leaderboard table',
}),
accessor: 'courseCompletions',
accessor: 'courseCompletionCount',
},
]}
/>
Expand Down
16 changes: 8 additions & 8 deletions src/components/AdvanceAnalyticsV2/tabs/Leaderboard.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,24 +28,24 @@ const mockLeaderboardData = {
results: [
{
email: '[email protected]',
daily_sessions: 74,
session_count: 74,
learning_time_hours: 13.1,
average_session_length: 1.8,
course_completions: 3,
course_completion_count: 3,
},
{
email: '[email protected]',
daily_sessions: 48,
session_count: 48,
learning_time_hours: 131.9,
average_session_length: 2.7,
course_completions: 1,
course_completion_count: 1,
},
{
email: '[email protected]',
daily_sessions: 92,
session_count: 92,
learning_time_hours: 130,
average_session_length: 1.4,
course_completions: 3,
course_completion_count: 3,
},
],
};
Expand Down Expand Up @@ -134,9 +134,9 @@ describe('Leaderboard Component', () => {
const rowCells = within(rows[index + 1]).getAllByRole('cell'); // Skip header row
expect(rowCells[0]).toHaveTextContent(user.email);
expect(rowCells[1]).toHaveTextContent(user.learning_time_hours);
expect(rowCells[2]).toHaveTextContent(user.daily_sessions);
expect(rowCells[2]).toHaveTextContent(user.session_count);
expect(rowCells[3]).toHaveTextContent(user.average_session_length);
expect(rowCells[4]).toHaveTextContent(user.course_completions);
expect(rowCells[4]).toHaveTextContent(user.course_completion_count);
});
});
});
Expand Down
89 changes: 0 additions & 89 deletions src/components/AdvanceAnalyticsV2/tests/DownloadCSV.test.jsx

This file was deleted.

4 changes: 2 additions & 2 deletions src/data/services/tests/EnterpriseDataApiService.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ const mockAnalyticsSkillsData = {
const mockAnalyticsLeaderboardTableData = [
{
email: '[email protected]',
dailySessions: 243,
sessionCount: 243,
learningTimeSeconds: 1111,
learningTimeHours: 3.4,
averageSessionLength: 1.6,
courseCompletions: 4,
courseCompletionCount: 4,
},
];

Expand Down

0 comments on commit 9ba101e

Please sign in to comment.