Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions src/app/api/models/task.ts
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,9 @@ export class Task extends Entity {

return this.definition.localDueDate();
}
public get checklocalDueDate(): Date {
return this.localDueDate();
}

public localDueDateString(): string {
const locale: string = AppInjector.get(LOCALE_ID);
Expand All @@ -255,7 +258,20 @@ export class Task extends Entity {

return Math.ceil(diffInDays / 7);
}
public get taskPeriodProgress() {
const today = new Date();

//use Math.abs to avoid sign
if (today <= this.startDate) return 0;
if (today >= this.checklocalDueDate) return 50;

const startToNow = Math.abs(today.valueOf() - this.startDate.valueOf());
const totalDuration = Math.abs(this.taskTotalDuration);
return Math.round((startToNow / totalDuration) * 50);
}
public get taskTotalDuration(): number {
return this.checklocalDueDate.valueOf() - this.startDate.valueOf();
}
/**
* Set the task to be due in a specific week.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export class TaskDateSliderComponent implements OnChanges {
) {}

public get max(): number {
return this.task.unit.totalWeeks + Math.ceil(this.task.project.specConDays / 7);
return 50;
}

ngOnChanges(changes: SimpleChanges): void {
Expand All @@ -41,7 +41,7 @@ export class TaskDateSliderComponent implements OnChanges {
this.cancelEdit();
}

this.value = this.task.dueWeek;
this.value = this.task.taskPeriodProgress;
this._originalDueDate = this.task.dueDate;
this._originalExtension = this.task.extensions;
}
Expand Down
40 changes: 28 additions & 12 deletions src/app/home/states/home/home.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -117,18 +117,34 @@ <h2>Enrolled units</h2>
</mat-card>
</div>
</div>
<a uiSref="view-all-projects">
<button
matTooltip="View previous units"
matTooltipPosition="above"
color="primary"
mat-fab
extended
aria-label="view all projects"
>
<mat-icon style="color: white">history</mat-icon> View all
</button>
</a>
<!--Start for two buttons All for dashboard and All for all prev Units-->
<div class="flex flex-col justify-around items-start h-60">
<a uiSref="view-all-projects">
<button
matTooltip="View current units"
matTooltipPosition="above"
color="primary"
mat-fab
extended
aria-label="view all projects"
>
<mat-icon style="color: white">dashboard</mat-icon> View all
</button>
</a>
<a uiSref="view-all-projects">
<button
matTooltip="View previous units"
matTooltipPosition="above"
color="primary"
mat-fab
extended
aria-label="view previous projects"
>
<mat-icon style="color: white">history</mat-icon> View previous
</button>
</a>
</div>
<!--end here so far-->
</div>
</div>
</div>
Expand Down
Loading