Skip to content

Commit

Permalink
Small cleanup on DailyTotals function
Browse files Browse the repository at this point in the history
  • Loading branch information
mikat-polarsquad committed Oct 23, 2019
1 parent f26c5a3 commit 8df681a
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions hours.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ func (e TimeEntries) Total() float64 {
// Overtime is overtime for that day.
func (e *TimeEntries) DailyTotals(daySelector time.Time) (hours float64, saldo float64, overtime float64) {
// var selection Entries
// var saldoused = false

date := daySelector.Format("2006-01-02") // TODO: Switch to get formatter from config

Expand All @@ -68,13 +67,11 @@ func (e *TimeEntries) DailyTotals(daySelector time.Time) (hours float64, saldo f
// selection = append(selection, v)
if IsWorkday(daySelector) {
if v.Task.Id == 8814697 { // TODO: Switch to use variable from config.
// saldoused = true
saldo = saldo + v.Hours
} else {
hours = hours + v.Hours
}

// Calculate is the day full 7.5 hours, even if saldo using saldos.
} else {
hours = v.Hours
overtime = v.Hours
Expand All @@ -83,6 +80,7 @@ func (e *TimeEntries) DailyTotals(daySelector time.Time) (hours float64, saldo f
}
if IsWorkday(daySelector) {
if hours+saldo != 7.5 {
// Calculate if the day full 7.5 hours, even if saldo using saldos.
overtime = (hours + saldo) - 7.5
}
}
Expand Down

0 comments on commit 8df681a

Please sign in to comment.