Last active
November 19, 2020 15:48
-
-
Save chasebaker21/ac8d6729095ebdfc2f7855d1a88b9d00 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// updates the timesheet hours everytime the inputs are changed | |
onChanges() { | |
this.projectForm.get('projectTime').valueChanges.subscribe(val => { | |
let x = val.length; | |
for (let i = 0; x > i;) { | |
let total = (Number(val[i].hoursHashMap.Sunday.hours) | |
+ Number(val[i].hoursHashMap.Monday.hours) | |
+ Number(val[i].hoursHashMap.Tuesday.hours) | |
+ Number(val[i].hoursHashMap.Wednesday.hours) | |
+ Number(val[i].hoursHashMap.Thursday.hours) | |
+ Number(val[i].hoursHashMap.Friday.hours) | |
+ Number(val[i].hoursHashMap.Saturday.hours)); | |
this.projectWeekTotals.splice(i, 1, total); | |
i++; | |
this.getTotalHours(); | |
this.project.emit(this.projectForm); | |
} | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment