Skip to content

Commit 8222aef

Browse files
authored
Merge pull request #428 from openedx/knguyen2/ent-9450
fix: update logic to show subsidy cards
2 parents 28257fe + b31c46a commit 8222aef

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

src/Configuration/Customers/CustomerDetailView/CustomerPlanContainer.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const CustomerPlanContainer = ({
1414
}) => {
1515
const [showInactive, setShowInactive] = useState(false);
1616
const countOfActivePlans = activeSubscriptions.length + activeSubsidies.length;
17-
const countOfInactivePlans = inactiveSubscriptions.length + activeSubsidies.length;
17+
const countOfInactivePlans = inactiveSubscriptions.length + inactiveSubsidies.length;
1818
const countOfAllPlans = countOfActivePlans + countOfInactivePlans;
1919
useEffect(() => {
2020
if (!countOfActivePlans && countOfAllPlans) {

src/Configuration/Customers/CustomerDetailView/CustomerViewContainer.jsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,16 @@ const CustomerViewContainer = () => {
4141
}, [fetchData]);
4242

4343
const renderPlanContainer = () => {
44-
if (!isLoading && !associatedPlans.isLoading && associatedPlans.countOfAllPlans) {
44+
if (!isLoading && !associatedPlans.isLoading
45+
&& (associatedPlans.activeSubsidies.length > 0 || associatedPlans.activeSubscriptions.length > 0)) {
4546
return (
4647
<Stack gap={2}>
4748
<CustomerPlanContainer slug={enterpriseCustomer.slug} {...associatedPlans} />
4849
</Stack>
4950
);
5051
}
51-
if (!associatedPlans.isLoading && !associatedPlans.countOfAllPlans) {
52+
if (!associatedPlans.isLoading
53+
&& (!associatedPlans.activeSubsidies.length || !associatedPlans.activeSubscriptions.length)) {
5254
return false;
5355
}
5456
if (associatedPlans.isLoading) {

src/Configuration/Customers/CustomerDetailView/tests/CustomerPlanContainer.test.jsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,6 @@ describe('CustomerPlanContainer', () => {
5353
expirationDate: '2024-09-02T20:02:57.651943Z',
5454
uuid: 'test-uuid',
5555
}],
56-
countOfActivePlans: 2,
57-
countOfAllPlans: 3,
5856
inactiveSubscriptions: [],
5957
inactiveSubsidies: [{
6058
activeDatetime: '2024-08-23T20:02:57.651943Z',

0 commit comments

Comments
 (0)