From ed9a35625cc213f56e17c82b326c09c53c8680e6 Mon Sep 17 00:00:00 2001 From: Corey Koelewyn Date: Mon, 29 Jul 2024 16:53:14 -0700 Subject: [PATCH] EPICSYSTEM-117: Fixed logic for PCP badge when no PCP exists --- src/app/models/commentperiod.ts | 9 ++++++--- ...t-notification-documents-table-details.component.html | 5 ++--- src/app/shared/utils/constants.ts | 1 + 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/app/models/commentperiod.ts b/src/app/models/commentperiod.ts index 9135358e..68ff714f 100644 --- a/src/app/models/commentperiod.ts +++ b/src/app/models/commentperiod.ts @@ -120,7 +120,10 @@ export class CommentPeriod { const dateStarted = moment(obj.dateStarted); const dateCompleted = moment(obj.dateCompleted); - if (moment(now).isBetween(dateStarted, dateCompleted)) { + if (moment(now).isBefore(dateStarted)) { + this.commentPeriodStatus = 'Pending'; + this.daysRemaining = 'Pending'; + } else if (moment(now).isBetween(dateStarted, dateCompleted)) { this.commentPeriodStatus = 'Open'; this.daysRemainingCount = dateCompleted.diff(moment(now), 'days'); this.daysRemaining = this.daysRemainingCount === 0 ? 'Final Day' : this.daysRemainingCount + (this.daysRemainingCount === 1 ? ' Day ' : ' Days ') + 'Remaining'; @@ -128,8 +131,8 @@ export class CommentPeriod { this.commentPeriodStatus = 'Closed'; this.daysRemaining = 'Completed'; } else { - this.commentPeriodStatus = 'Pending'; - this.daysRemaining = 'Pending'; + this.commentPeriodStatus = 'None'; + this.daysRemaining = 'None'; } } diff --git a/src/app/project-notifications/project-notification-documents-table-details/project-notification-documents-table-details.component.html b/src/app/project-notifications/project-notification-documents-table-details/project-notification-documents-table-details.component.html index 301c2da0..26a7288b 100644 --- a/src/app/project-notifications/project-notification-documents-table-details/project-notification-documents-table-details.component.html +++ b/src/app/project-notifications/project-notification-documents-table-details/project-notification-documents-table-details.component.html @@ -70,9 +70,8 @@

{{(rowData.name.toUpperCase() || '-')}}

View Pending Comment Period diff --git a/src/app/shared/utils/constants.ts b/src/app/shared/utils/constants.ts index 0c25ca0c..393b7b9f 100644 --- a/src/app/shared/utils/constants.ts +++ b/src/app/shared/utils/constants.ts @@ -42,6 +42,7 @@ export class Constants { }; public static readonly PCP_COLLECTION: object[] = [ + { code: 'none', name: 'None'}, { code: 'pending', name: 'Pending' }, { code: 'open', name: 'Open' }, { code: 'closed', name: 'Closed' }