Skip to content

Commit

Permalink
fix(1-3377): handle singular counts in project status lifecycle boxes (
Browse files Browse the repository at this point in the history
…#9317)

If the average number of days in a stage is 1, use `1 day` instead of
`1 days`.

Likewise, if your total number of archived flags is 1, use `1 flag
archived` instead of `1 flags archived`.

I grepped through the file, but couldn't find any other hardcoded
instances of "flags" or "days", so I think this is everything.
  • Loading branch information
thomasheartman authored Feb 17, 2025
1 parent 134c325 commit b15502e
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,8 @@ const AverageDaysStat: FC<{ averageDays?: number | null }> = ({

if (averageDays < 1) {
return 'less than a day';
} else if (averageDays === 1) {
return '1 day';
}
return `${averageDays} days`;
};
Expand Down Expand Up @@ -165,6 +167,10 @@ export const ProjectLifecycleSummary = () => {
);
};

const archivedLast30DaysCount =
data?.lifecycleSummary.archived.last30Days ?? 0;
const totalArchivedText = `${archivedLast30DaysCount} ${archivedLast30DaysCount === 1 ? 'flag' : 'flags'} archived`;

return (
<LifecycleList ref={loadingRef}>
<LifecycleBox tooltipText={lifecycleMessages.initial}>
Expand Down Expand Up @@ -258,8 +264,7 @@ export const ProjectLifecycleSummary = () => {
<Stats>
<dt>Last 30 days</dt>
<dd data-loading-project-lifecycle-summary>
{data?.lifecycleSummary.archived.last30Days ?? 0} flags
archived
{totalArchivedText}
</dd>
</Stats>
</LifecycleBox>
Expand Down

0 comments on commit b15502e

Please sign in to comment.