Skip to content

Commit

Permalink
fix: remove top down assignment featured flag
Browse files Browse the repository at this point in the history
  • Loading branch information
iloveagent57 committed Dec 4, 2024
1 parent 1a537e4 commit 94f2c3d
Show file tree
Hide file tree
Showing 26 changed files with 21 additions and 166 deletions.
4 changes: 1 addition & 3 deletions docs/decisions/0008-application_state_differenciation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,7 @@ Note that the ``queryClient`` is a test utility function that populates the ``Qu
const initialStore = {
portalConfiguration: {
enterpriseId: 'test-id',
enterpriseFeatures: {
topDownAssignmentRealTimeLcm: true,
},
enterpriseFeatures: {},
enablePortalLearnerCreditManagementScreen: true,
},
};
Expand Down
3 changes: 0 additions & 3 deletions src/components/Admin/Admin.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,6 @@ const mockStore = configureMockStore([thunk]);
const store = mockStore({
portalConfiguration: {
enterpriseId: 'test-enterprise-id',
enterpriseFeatures: {
topDownAssignmentRealTimeLcm: true,
},
},
table: {},
csv: {},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@ const mockStore = configureMockStore([thunk]);
const store = mockStore({
portalConfiguration: {
enterpriseId: 'test-enterprise-id',
enterpriseFeatures: {
topDownAssignmentRealTimeLcm: true,
},
enterpriseFeatures: {},
},
table: {},
csv: {},
Expand Down
3 changes: 0 additions & 3 deletions src/components/BudgetExpiryAlertAndModal/data/index.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,6 @@ const initialStoreState = {
enterpriseId: enterpriseUUID,
enterpriseSlug,
disableExpiryMessagingForLearnerCredit: false,
enterpriseFeatures: {
topDownAssignmentRealTimeLcm: true,
},
},
};
const mockEnterpriseBudgetUuid = uuidv4();
Expand Down
7 changes: 1 addition & 6 deletions src/components/BudgetExpiryAlertAndModal/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import EVENT_NAMES from '../../eventTracking';

import useExpiry from './data/hooks/useExpiry';

const BudgetExpiryAlertAndModal = ({ enterpriseUUID, enterpriseFeatures, disableExpiryMessagingForLearnerCredit }) => {
const BudgetExpiryAlertAndModal = ({ enterpriseUUID, disableExpiryMessagingForLearnerCredit }) => {
const [modalIsOpen, modalOpen, modalClose] = useToggle(false);
const [alertIsOpen, alertOpen, alertClose] = useToggle(false);
const location = useLocation();
Expand All @@ -30,7 +30,6 @@ const BudgetExpiryAlertAndModal = ({ enterpriseUUID, enterpriseFeatures, disable
const supportUrl = configuration.ENTERPRISE_SUPPORT_URL;

const { data: budgets } = useEnterpriseBudgets({
isTopDownAssignmentEnabled: enterpriseFeatures.topDownAssignmentRealTimeLcm,
enterpriseId: enterpriseUUID,
enablePortalLearnerCreditManagementScreen: true,
queryOptions: {
Expand Down Expand Up @@ -148,15 +147,11 @@ const BudgetExpiryAlertAndModal = ({ enterpriseUUID, enterpriseFeatures, disable

const mapStateToProps = state => ({
enterpriseUUID: state.portalConfiguration.enterpriseId,
enterpriseFeatures: state.portalConfiguration.enterpriseFeatures,
disableExpiryMessagingForLearnerCredit: state.portalConfiguration.disableExpiryMessagingForLearnerCredit,
});

BudgetExpiryAlertAndModal.propTypes = {
enterpriseUUID: PropTypes.string.isRequired,
enterpriseFeatures: PropTypes.shape({
topDownAssignmentRealTimeLcm: PropTypes.bool.isRequired,
}),
disableExpiryMessagingForLearnerCredit: PropTypes.bool.isRequired,
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ const EnterpriseAppContextProvider = ({
const enterpriseSubsidiesContext = useEnterpriseSubsidiesContext({
enterpriseId,
enablePortalLearnerCreditManagementScreen,
isTopDownAssignmentEnabled: enterpriseFeatures.topDownAssignmentRealTimeLcm,
});

// subsidy requests for the enterprise customer
Expand Down Expand Up @@ -108,9 +107,7 @@ const EnterpriseAppContextProvider = ({
EnterpriseAppContextProvider.propTypes = {
enterpriseId: PropTypes.string.isRequired,
enterpriseName: PropTypes.string.isRequired,
enterpriseFeatures: PropTypes.shape({
topDownAssignmentRealTimeLcm: PropTypes.bool,
}).isRequired,
enterpriseFeatures: PropTypes.object.isRequired,

Check failure on line 110 in src/components/EnterpriseApp/EnterpriseAppContextProvider.jsx

View workflow job for this annotation

GitHub Actions / tests

Prop type "object" is forbidden
enablePortalLearnerCreditManagementScreen: PropTypes.bool.isRequired,
children: PropTypes.node.isRequired,
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@ const TEST_ENTERPRISE_NAME = 'test-enterprise-name';

jest.mock('./data/hooks');

const mockEnterpriseFeatures = {
topDownAssignmentRealTimeLcm: true,
};

describe('<EnterpriseAppContextProvider />', () => {
it.each([{
isLoadingEnterpriseSubsidies: true,
Expand Down Expand Up @@ -84,7 +80,6 @@ describe('<EnterpriseAppContextProvider />', () => {
<EnterpriseAppContextProvider
enterpriseId={TEST_ENTERPRISE_UUID}
enterpriseName={TEST_ENTERPRISE_NAME}
enterpriseFeatures={mockEnterpriseFeatures}
enablePortalLearnerCreditManagementScreen
>
children
Expand Down
1 change: 0 additions & 1 deletion src/components/EnterpriseApp/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,6 @@ EnterpriseApp.propTypes = {
enterpriseId: PropTypes.string,
enterpriseName: PropTypes.string,
enterpriseFeatures: PropTypes.shape({
topDownAssignmentRealTimeLcm: PropTypes.bool,
enterpriseGroupsV2: PropTypes.bool,
}),
enterpriseBranding: PropTypes.shape({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ const initialStoreState = {
enterpriseSlug,
enableLearnerPortal: true,
enterpriseFeatures: {
topDownAssignmentRealTimeLcm: true,
enterpriseGroupsV1: true,
enterpriseGroupsV2: true,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import NoAssignableBudgetActivity from './empty-state/NoAssignableBudgetActivity
import NoBnEBudgetActivity from './empty-state/NoBnEBudgetActivity';

const BudgetDetailActivityTabContents = ({ enterpriseUUID, enterpriseFeatures, appliesToAllContexts }) => {
const isTopDownAssignmentEnabled = enterpriseFeatures.topDownAssignmentRealTimeLcm;
const { enterpriseOfferId, subsidyAccessPolicyId } = useBudgetId();
const { data: subsidyAccessPolicy } = useSubsidyAccessPolicy(subsidyAccessPolicyId);
const isEnterpriseGroupsEnabled = enterpriseFeatures.enterpriseGroupsV1
Expand All @@ -23,8 +22,7 @@ const BudgetDetailActivityTabContents = ({ enterpriseUUID, enterpriseFeatures, a
isFetching: isBudgetActivityOverviewFetching,
data: budgetActivityOverview,
} = useBudgetDetailActivityOverview({
enterpriseUUID,
isTopDownAssignmentEnabled,
enterpriseUUID

Check failure on line 25 in src/components/learner-credit-management/BudgetDetailActivityTabContents.jsx

View workflow job for this annotation

GitHub Actions / tests

Missing trailing comma
});

// If the budget activity overview data is loading (either the initial request OR any
Expand All @@ -44,7 +42,7 @@ const BudgetDetailActivityTabContents = ({ enterpriseUUID, enterpriseFeatures, a
// If enterprise groups is turned on, it's learner credit NOT enterprise offers w/ no spend
const renderBnEActivity = isEnterpriseGroupsEnabled && (enterpriseOfferId == null) && !hasSpentTransactions;

if (!isTopDownAssignmentEnabled || !subsidyAccessPolicy?.isAssignable) {
if (!subsidyAccessPolicy?.isAssignable) {
if (isEnterpriseGroupsEnabled) {
if (appliesToAllContexts) {
return (
Expand Down Expand Up @@ -98,7 +96,6 @@ const mapStateToProps = state => ({
BudgetDetailActivityTabContents.propTypes = {
enterpriseUUID: PropTypes.string.isRequired,
enterpriseFeatures: PropTypes.shape({
topDownAssignmentRealTimeLcm: PropTypes.bool,
enterpriseGroupsV1: PropTypes.bool,
}).isRequired,
appliesToAllContexts: PropTypes.bool.isRequired,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,15 +105,13 @@ BudgetDetailAssignmentsHeader.propTypes = {
const BudgetDetailAssignments = ({
hasContentAssignments,
hasSpentTransactions,
enterpriseFeatures,
enterpriseId,
}) => {
const intl = useIntl();
const { subsidyAccessPolicyId } = useBudgetId();
const { data: subsidyAccessPolicy } = useSubsidyAccessPolicy(subsidyAccessPolicyId);
const isAssignableBudget = !!subsidyAccessPolicy?.isAssignable;
const assignmentConfigurationUUID = subsidyAccessPolicy?.assignmentConfiguration?.uuid;
const isTopDownAssignmentEnabled = enterpriseFeatures.topDownAssignmentRealTimeLcm;
const {
isLoading,
contentAssignments,
Expand All @@ -130,7 +128,7 @@ const BudgetDetailAssignments = ({
isBudgetRetired: subsidyAccessPolicy.retired,
});

if (!isTopDownAssignmentEnabled || !isAssignableBudget) {
if (!isAssignableBudget) {
return null;
}

Expand All @@ -155,16 +153,12 @@ const BudgetDetailAssignments = ({

const mapStateToProps = state => ({
enterpriseId: state.portalConfiguration.enterpriseId,
enterpriseFeatures: state.portalConfiguration.enterpriseFeatures,
});

BudgetDetailAssignments.propTypes = {
enterpriseId: PropTypes.string.isRequired,
hasContentAssignments: PropTypes.bool.isRequired,
hasSpentTransactions: PropTypes.bool.isRequired,
enterpriseFeatures: PropTypes.shape({
topDownAssignmentRealTimeLcm: PropTypes.bool,
}).isRequired,
};

export default connect(mapStateToProps)(BudgetDetailAssignments);
Original file line number Diff line number Diff line change
Expand Up @@ -430,11 +430,10 @@ const BudgetDetailPageOverviewAvailability = ({
<Col lg={5}>
<BudgetActions
budgetId={budgetId}
isAssignable={isAssignable && enterpriseFeatures.topDownAssignmentRealTimeLcm}
isAssignable={isAssignable}
enterpriseId={enterpriseId}
enterpriseGroupsV1={enterpriseFeatures.enterpriseGroupsV1}
status={status}
isTopDownAssignmentEnabled={enterpriseFeatures.topDownAssignmentRealTimeLcm}
/>
</Col>
</Row>
Expand All @@ -450,7 +449,6 @@ BudgetDetailPageOverviewAvailability.propTypes = {
}).isRequired,
isAssignable: PropTypes.bool.isRequired,
enterpriseFeatures: PropTypes.shape({
topDownAssignmentRealTimeLcm: PropTypes.bool,
enterpriseGroupsV1: PropTypes.bool,
}).isRequired,
enterpriseId: PropTypes.string.isRequired,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ const BudgetDetailPageOverviewUtilization = ({
budgetTotalSummary: { utilized },
budgetAggregates,
isAssignable,
enterpriseFeatures,
enterpriseId,
isRetired,
}) => {
Expand All @@ -33,7 +32,6 @@ const BudgetDetailPageOverviewUtilization = ({
if (
!budgetId
|| isRetired
|| !enterpriseFeatures.topDownAssignmentRealTimeLcm
|| utilized <= 0
|| !isAssignable
) {
Expand Down Expand Up @@ -186,15 +184,11 @@ BudgetDetailPageOverviewUtilization.propTypes = {
budgetTotalSummary: PropTypes.shape(budgetTotalSummaryShape).isRequired,
budgetAggregates: PropTypes.shape(budgetAggregatesShape).isRequired,
isAssignable: PropTypes.bool.isRequired,
enterpriseFeatures: PropTypes.shape({
topDownAssignmentRealTimeLcm: PropTypes.bool,
}).isRequired,
enterpriseId: PropTypes.string.isRequired,
isRetired: PropTypes.bool.isRequired,
};

const mapStateToProps = state => ({
enterpriseFeatures: state.portalConfiguration.enterpriseFeatures,
enterpriseId: state.portalConfiguration.enterpriseId,
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import { BUDGET_STATUSES } from '../EnterpriseApp/data/constants';

const BudgetDetailRedemptionsDescription = ({
status,
enterpriseFeatures,
}) => {
const { enterpriseOfferId, subsidyAccessPolicyId } = useBudgetId();

Expand All @@ -36,7 +35,7 @@ const BudgetDetailRedemptionsDescription = ({
defaultMessage="Spent activity is driven by completed enrollments. "
description="Description for the spent section of the budget detail page"
/>
{(enterpriseOfferId || (subsidyAccessPolicyId && !enterpriseFeatures.topDownAssignmentRealTimeLcm)) ? (
{(enterpriseOfferId || subsidyAccessPolicyId) ? (
<FormattedMessage
id="lcm.budget.detail.page.spent.description.enterprise"
defaultMessage="Enrollment data is automatically updated every 12 hours. Come back later to view more recent enrollments."
Expand All @@ -63,12 +62,9 @@ const BudgetDetailRedemptionsDescription = ({

BudgetDetailRedemptionsDescription.propTypes = {
status: PropTypes.string.isRequired,
enterpriseFeatures: PropTypes.shape({
topDownAssignmentRealTimeLcm: PropTypes.bool,
}).isRequired,
};

const BudgetDetailRedemptions = ({ enterpriseFeatures, enterpriseUUID }) => {
const BudgetDetailRedemptions = ({ enterpriseUUID }) => {
const intl = useIntl();
const navigate = useNavigate();
const location = useLocation();
Expand All @@ -83,7 +79,6 @@ const BudgetDetailRedemptions = ({ enterpriseFeatures, enterpriseUUID }) => {
enterpriseUUID,
enterpriseOfferId,
subsidyAccessPolicyId,
enterpriseFeatures.topDownAssignmentRealTimeLcm,
);

const { data: enterpriseOfferMetadata } = useEnterpriseOffer(enterpriseOfferId);
Expand Down Expand Up @@ -114,7 +109,7 @@ const BudgetDetailRedemptions = ({ enterpriseFeatures, enterpriseUUID }) => {
description="Heading for the spent section of the budget detail page"
/>
</h3>
<BudgetDetailRedemptionsDescription enterpriseFeatures={enterpriseFeatures} status={status} />
<BudgetDetailRedemptionsDescription status={status} />
<LearnerCreditAllocationTable
isLoading={isLoading}
tableData={budgetRedemptions}
Expand All @@ -125,15 +120,11 @@ const BudgetDetailRedemptions = ({ enterpriseFeatures, enterpriseUUID }) => {
};

const mapStateToProps = state => ({
enterpriseFeatures: state.portalConfiguration.enterpriseFeatures,
enterpriseUUID: state.portalConfiguration.enterpriseId,
});

BudgetDetailRedemptions.propTypes = {
enterpriseUUID: PropTypes.string.isRequired,
enterpriseFeatures: PropTypes.shape({
topDownAssignmentRealTimeLcm: PropTypes.bool,
}).isRequired,
};

export default connect(mapStateToProps)(BudgetDetailRedemptions);
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ function isSupportedTabKey({
appliesToAllContexts,
}) {
const showCatalog = (subsidyAccessPolicy?.groupAssociations?.length > 0)
|| (enterpriseFeatures.topDownAssignmentRealTimeLcm && !!subsidyAccessPolicy?.isAssignable);
|| !!subsidyAccessPolicy?.isAssignable;
const supportedTabs = [BUDGET_DETAIL_ACTIVITY_TAB];
if (showCatalog) {
supportedTabs.push(BUDGET_DETAIL_CATALOG_TAB);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import BudgetStatusSubtitle from './BudgetStatusSubtitle';

const BudgetOverviewContent = ({
enterpriseUUID,
enterpriseFeatures,
}) => {
const intl = useIntl();
const { subsidyAccessPolicyId, enterpriseOfferId } = useBudgetId();
Expand Down Expand Up @@ -50,7 +49,6 @@ const BudgetOverviewContent = ({
subsidySummary,
budgetId: policyOrOfferId,
enterpriseOfferMetadata,
isTopDownAssignmentEnabled: enterpriseFeatures.topDownAssignmentRealTimeLcm,
});

if (!subsidyAccessPolicy && (isLoadingSubsidySummary || isLoadingEnterpriseOffer)) {
Expand Down Expand Up @@ -102,14 +100,10 @@ const BudgetOverviewContent = ({

const mapStateToProps = state => ({
enterpriseUUID: state.portalConfiguration.enterpriseId,
enterpriseFeatures: state.portalConfiguration.enterpriseFeatures,
});

BudgetOverviewContent.propTypes = {
enterpriseUUID: PropTypes.string.isRequired,
enterpriseFeatures: PropTypes.shape({
topDownAssignmentRealTimeLcm: PropTypes.bool,
}).isRequired,
};

export default connect(mapStateToProps)(BudgetOverviewContent);
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ const MultipleBudgetsPage = ({
enterpriseUUID,
enterpriseSlug,
enableLearnerPortal,
enterpriseFeatures,
enablePortalLearnerCreditManagementScreen,
}) => {
const intl = useIntl();
Expand All @@ -37,7 +36,6 @@ const MultipleBudgetsPage = ({
const { data: budgetsOverview } = useEnterpriseBudgets({
enterpriseId: enterpriseUUID,
enablePortalLearnerCreditManagementScreen,
isTopDownAssignmentEnabled: enterpriseFeatures.topDownAssignmentRealTimeLcm,
});
const {
budgets = [],
Expand Down Expand Up @@ -121,17 +119,13 @@ const mapStateToProps = state => ({
enterpriseUUID: state.portalConfiguration.enterpriseId,
enterpriseSlug: state.portalConfiguration.enterpriseSlug,
enableLearnerPortal: state.portalConfiguration.enableLearnerPortal,
enterpriseFeatures: state.portalConfiguration.enterpriseFeatures,
enablePortalLearnerCreditManagementScreen: state.portalConfiguration.enablePortalLearnerCreditManagementScreen,
});

MultipleBudgetsPage.propTypes = {
enterpriseUUID: PropTypes.string.isRequired,
enterpriseSlug: PropTypes.string.isRequired,
enableLearnerPortal: PropTypes.bool.isRequired,
enterpriseFeatures: PropTypes.shape({
topDownAssignmentRealTimeLcm: PropTypes.bool,
}).isRequired,
enablePortalLearnerCreditManagementScreen: PropTypes.bool.isRequired,
};

Expand Down
Loading

0 comments on commit 94f2c3d

Please sign in to comment.