Skip to content

Commit

Permalink
Merge pull request #692 from Ckoelewyn/EPICSYSTEM-117
Browse files Browse the repository at this point in the history
EPICSYSTEM-117: Fixed logic for PCP badge when no PCP exists
  • Loading branch information
Ckoelewyn authored Jul 30, 2024
2 parents ea8f721 + ed9a356 commit e34dedc
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
9 changes: 6 additions & 3 deletions src/app/models/commentperiod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,16 +120,19 @@ 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';
} else if (moment(now).isAfter(dateCompleted)) {
this.commentPeriodStatus = 'Closed';
this.daysRemaining = 'Completed';
} else {
this.commentPeriodStatus = 'Pending';
this.daysRemaining = 'Pending';
this.commentPeriodStatus = 'None';
this.daysRemaining = 'None';
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,8 @@ <h4>{{(rowData.name.toUpperCase() || '-')}}</h4>
View Pending Comment Period
</a>
<a *ngIf="
(rowData.commentPeriod?.commentPeriodStatus === 'Pending' &&
!rowData.commentPeriod?.isMet) ||
!rowData.commentPeriod?.commentPeriodStatus"
rowData.commentPeriod?.commentPeriodStatus === 'Pending' &&
!rowData.commentPeriod?.isMet"
class="btn btn-primary view-pcp-btn"
title="View this Public Comment Period"
>
Expand Down
1 change: 1 addition & 0 deletions src/app/shared/utils/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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' }
Expand Down

0 comments on commit e34dedc

Please sign in to comment.