Skip to content

Commit

Permalink
feat: avoid clocking in when no scheduled hours for current day
Browse files Browse the repository at this point in the history
  • Loading branch information
Madh93 committed Jul 16, 2023
1 parent 2c3da73 commit f686c94
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions internal/toffu/toffu.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,15 @@ func (t *Toffu) ClockIn() (err error) {
return errors.New("error clocking in, you have already clocked in")
}

workday, err := t.api.GetUserWorkDay(userId)
if err != nil {
return err
}

if workday.ScheduleHours <= 0.0 {
return errors.New("error clocking in, no scheduled working hours today")
}

err = t.api.Sign(userId)
if err != nil {
return fmt.Errorf("error clocking in: %v", err)
Expand Down

0 comments on commit f686c94

Please sign in to comment.