Skip to content

Commit

Permalink
Merge pull request #358 from openedx/knguyen2/ENT-7784
Browse files Browse the repository at this point in the history
fix: associated catalog selection bug in prod
  • Loading branch information
katrinan029 authored Oct 3, 2023
2 parents 445625e + 498831e commit dfc178f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ const mocks = {
enterprise_customer: '4a67c952-8eb1-44ba-9ab3-2faa5d0905de',
title: '4a67c952-8eb1-44ba-9ab3-2faa5d0905de - Open Courses budget',
uuid: '69035754-fa48-4519-92d8-a723ae0f6e58',
enterprise_catalog_query: 29,
enterprise_catalog_query: 2,
}],
},
},
Expand Down
15 changes: 0 additions & 15 deletions src/Configuration/Provisioning/data/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -267,21 +267,6 @@ export const INITIAL_CATALOG_QUERIES = {
],
};

export const CATALOG_QUERIES = {
Everything: {
id: 28,
catalogQueryTitle: 'Everything',
},
'Executive Education budget': {
id: 29,
catalogQueryTitle: 'Executive Education budget',
},
'Open Courses budget': {
id: 30,
catalogQueryTitle: 'Open Courses budget',
},
};

export const MAX_PAGE_SIZE = 12;

export default PROVISIONING_PAGE_TEXT;
11 changes: 6 additions & 5 deletions src/Configuration/Provisioning/data/hooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import LmsApiService from '../../../data/services/EnterpriseApiService';
import PROVISIONING_PAGE_TEXT, {
INITIAL_CATALOG_QUERIES,
MAX_PAGE_SIZE,
CATALOG_QUERIES,
splitStringBudget,
} from './constants';
import { ProvisioningContext } from '../ProvisioningContext';
Expand Down Expand Up @@ -239,6 +238,7 @@ export default function useProvisioningContext() {
const policiesData = policies.data.results.filter(policy => policy.subsidy_uuid === subsidyUuid).map(policy => {
let catalogCategoryTitle;
const formattedPolicies = [];
const predefinedQueries = getCamelCasedConfigAttribute('PREDEFINED_CATALOG_QUERIES');

catalogs.forEach(catalog => {
if (catalog.uuid === policy.catalog_uuid) {
Expand All @@ -254,10 +254,11 @@ export default function useProvisioningContext() {
title: catalogCategoryTitle,
catalogUuid: catalog.uuid,
};
} else if (catalog.enterprise_catalog_query === CATALOG_QUERIES['Open Courses budget'].id
|| catalog.enterprise_catalog_query === CATALOG_QUERIES.Everything.id
|| catalog.enterprise_catalog_query === CATALOG_QUERIES['Executive Education budget'].id
) {
} else if ([
predefinedQueries.everything,
predefinedQueries.executiveEducation,
predefinedQueries.openCourses,
].includes(catalog.enterprise_catalog_query)) {
catalogQuery = {
id: catalog?.enterprise_catalog_query,
title: catalogCategoryTitle.split(splitStringBudget)[0],
Expand Down

0 comments on commit dfc178f

Please sign in to comment.