Skip to content

Commit

Permalink
fix:#427 Days Remaining adjustment. (#432)
Browse files Browse the repository at this point in the history
Adjust daysRemaining.
  • Loading branch information
ianliuwk1019 authored Jul 23, 2023
1 parent 7b9003d commit f7b743e
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions admin/src/app/foms/fom-detail/fom-detail.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -257,8 +257,10 @@ export class FomDetailComponent implements OnInit, OnDestroy {
}

public canChangeEndDate(): boolean {
return this.user.isMinistry && (this.project.workflowState.code == WorkflowStateEnum.Initial
|| this.project.workflowState.code == WorkflowStateEnum.CommentOpen);
return this.user.isMinistry &&
(this.project.workflowState.code == WorkflowStateEnum.Initial
|| this.project.workflowState.code == WorkflowStateEnum.CommentOpen
) && !!this.project.commentingOpenDate;
}

public canEditFOM(): boolean {
Expand Down Expand Up @@ -347,7 +349,8 @@ export class FomDetailComponent implements OnInit, OnDestroy {
}

private calculateDaysRemaining(){
this.daysRemaining =
this.daysRemaining = (this.project.workflowState.code === WorkflowStateEnum.Initial) ?
moment(this.project.commentingClosedDate).diff(moment(this.project.commentingOpenDate), 'days') :
moment(this.project.commentingClosedDate).diff(moment(this.today), 'days');
if(this.daysRemaining < 0){
this.daysRemaining = 0;
Expand Down

0 comments on commit f7b743e

Please sign in to comment.