Skip to content

Commit

Permalink
Fix Clock In feature after API change
Browse files Browse the repository at this point in the history
Looks like factorial changed the API and the previous request was not working, changes applied generate a new type of shift that is what the API expects
  • Loading branch information
andreugallofre committed Jul 1, 2024
1 parent f9c7b6c commit 8719652
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions factorial/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ type shift struct {
Id int64 `json:"id"`
Period_id int64 `json:"period_id"`
Day int `json:"day"`
Date string `json:"date"`
Clock_in string `json:"clock_in"`
Clock_out string `json:"clock_out"`
Minutes int64 `json:"minutes"`
Expand Down Expand Up @@ -131,6 +132,7 @@ func (c *factorialClient) ClockIn(dry_run bool) {
if !dry_run {
ok = false
shift.Day = d.Day
shift.Date = fmt.Sprintf("%d-%d-%d", c.year, c.month, d.Day)
body, _ = json.Marshal(shift)
resp, _ = c.Post(BASE_URL+"/attendance/shifts", "application/json;charset=UTF-8", bytes.NewBuffer(body))
if resp.StatusCode == 201 {
Expand Down

0 comments on commit 8719652

Please sign in to comment.