Skip to content

Commit

Permalink
chore: deleted unneeded comments
Browse files Browse the repository at this point in the history
  • Loading branch information
katrinan029 committed Jan 15, 2025
1 parent 31f3350 commit dafc392
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export const BaseSelectWithContext = ({ row, enterpriseGroupLearners }) => {
checked,
...toggleRowSelectedProps
} = row.getToggleRowSelectedProps();
const isAddedMember = enterpriseGroupLearners.find(learner => learner.enterpriseCustomerUserId === Number(row.id));
const isAddedMember = enterpriseGroupLearners.find(learner => learner.lmsUserId === Number(row.id));
return (
<div>
<CheckboxControl
Expand Down Expand Up @@ -96,7 +96,7 @@ const EnterpriseCustomerUserDatatable = ({
isSortable
manualSortBy
initialTableOptions={{
getRowId: row => row.enterpriseCustomerUser.name.toString(),
getRowId: row => row.enterpriseCustomerUser.userId.toString(),
}}
pageCount={enterpriseMembersTableData.pageCount}
manualSelectColumn={
Expand Down
2 changes: 1 addition & 1 deletion src/components/PeopleManagement/PeopleManagementTable.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const PeopleManagementTable = ({ enterpriseId }) => {
pageSize: 10,
pageIndex: 0,
sortBy: [
{ id: 'enterpriseCustomerUser.name', desc: true },
{ id: 'name', desc: true },
],
filters: [],
}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
import { camelCaseObject } from '@edx/frontend-platform/utils';
import { logError } from '@edx/frontend-platform/logging';
import debounce from 'lodash.debounce';
import _ from 'lodash';
import snakeCase from 'lodash/snakeCase';

import LmsApiService from '../../../../data/services/LmsApiService';

Expand Down Expand Up @@ -35,21 +35,13 @@ const useEnterpriseMembersTableData = ({ enterpriseId }) => {
options.user_query = value;
}
});
// if (args?.sortBy.length > 0) {
// const sortByValue = args.sortBy[0].id;
// options.sort_by = _.snakeCase(sortByValue);
// if (!args.sortBy[0].desc) {
// options.is_reversed = !args.sortBy[0].desc;
// }

if (args?.sortBy.length > 0) {
const sortByValue = args.sortBy[0].id;
options.sort_by = _.snakeCase(sortByValue);
options.sort_by = snakeCase(sortByValue);
if (!args.sortBy[0].desc) {
options.is_reversed = !args.sortBy[0].desc;
}
}
// }
options.page = args.pageIndex + 1;
const response = await LmsApiService.fetchEnterpriseCustomerMembers(enterpriseId, options);
const data = camelCaseObject(response.data);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,31 +70,31 @@ const mockTabledata = {
results: [
{
enterpriseCustomerUser: {
user_id: 1,
userId: 1,
name: 'Test User 1',
email: '[email protected]',
joinedOrg: 'July 5, 2021',
},
},
{
enterpriseCustomerUser: {
user_id: 2,
userId: 2,
name: 'Test User 2',
email: '[email protected]',
joinedOrg: 'July 2, 2022',
},
},
{
enterpriseCustomerUser: {
user_id: 3,
userId: 3,
name: 'Test User 3',
email: '[email protected]',
joinedOrg: 'July 3, 2023',
},
},
{
enterpriseCustomerUser: {
user_id: 4,
userId: 4,
name: 'Test User 4',
email: '[email protected]',
joinedOrg: 'July 4, 2024',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,31 +67,31 @@ const mockTabledata = {
results: [
{
enterpriseCustomerUser: {
user_id: 1,
userId: 1,
name: 'Test User 1',
email: '[email protected]',
joinedOrg: 'July 5, 2021',
},
},
{
enterpriseCustomerUser: {
user_id: 2,
userId: 2,
name: 'Test User 2',
email: '[email protected]',
joinedOrg: 'July 2, 2022',
},
},
{
enterpriseCustomerUser: {
user_id: 3,
userId: 3,
name: 'Test User 3',
email: '[email protected]',
joinedOrg: 'July 3, 2023',
},
},
{
enterpriseCustomerUser: {
user_id: 4,
userId: 4,
name: 'Test User 4',
email: '[email protected]',
joinedOrg: 'July 4, 2024',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ describe('useEnterpriseMembersTableData', () => {
pageIndex: 0,
pageSize: 10,
filters: [],
sortBy: [],
sortBy: [{ id: 'joinedOrg', desc: false }],
});
await waitForNextUpdate();
expect(LmsApiService.fetchEnterpriseCustomerMembers).toHaveBeenCalledWith(mockEnterpriseUUID, { page: 1 });
expect(LmsApiService.fetchEnterpriseCustomerMembers).toHaveBeenCalledWith(mockEnterpriseUUID, { page: 1, is_reversed: true, sort_by: 'joined_org' });
expect(result.current.isLoading).toEqual(false);
expect(result.current.enterpriseMembersTableData.results).toEqual(camelCaseObject(mockData.results));
});
Expand Down

0 comments on commit dafc392

Please sign in to comment.