Skip to content

Commit f7134de

Browse files
committed
fixes No Deployment if totalDeployments exist
1 parent 8605f85 commit f7134de

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed

web-server/src/content/DoraMetrics/DoraCards/WeeklyDeliveryVolumeCard.tsx

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import {
1212
NoDataImg
1313
} from '@/content/DoraMetrics/DoraCards/sharedComponents';
1414
import { useAuth } from '@/hooks/useAuth';
15-
import { useCountUp } from '@/hooks/useCountUp';
1615
import {
1716
useCurrentDateRangeLabel,
1817
useStateDateConfig
@@ -56,10 +55,6 @@ export const WeeklyDeliveryVolumeCard = () => {
5655
const dateRangeLabel = useCurrentDateRangeLabel();
5756
const deploymentFrequencyProps = useAvgIntervalBasedDeploymentFrequency();
5857

59-
const deploymentFrequencyCount = useCountUp(
60-
deploymentFrequencyProps.count || 0
61-
);
62-
6358
const { addPage } = useOverlayPage();
6459
const deploymentsConfigured = true;
6560
const isCodeProviderIntegrationEnabled = integrationSet.has(
@@ -209,11 +204,12 @@ export const WeeklyDeliveryVolumeCard = () => {
209204
color={deploymentFrequencyProps.color}
210205
sx={{ fontSize: '3em' }}
211206
>
212-
{deploymentFrequencyProps.count ? (
213-
`${deploymentFrequencyCount}`
214-
) : (
215-
<Line>No Deployments</Line>
216-
)}
207+
<Line>
208+
{getDeploymentCountString(
209+
deploymentFrequencyProps.count,
210+
totalDeployments
211+
)}
212+
</Line>
217213
</Line>
218214
{Boolean(
219215
deploymentFrequencyProps.count ||
@@ -319,3 +315,11 @@ export const WeeklyDeliveryVolumeCard = () => {
319315
</CardRoot>
320316
);
321317
};
318+
319+
const getDeploymentCountString = (count: number, totalDeployments: number) => {
320+
if (totalDeployments === 0) return 'No Deployments';
321+
if (count) return `${count}`;
322+
323+
// backend doesn't send decimals, so if total deps exist, count cannot be zero, it's less than 1
324+
return '<1';
325+
};

0 commit comments

Comments
 (0)