Skip to content

Commit

Permalink
fix: team capacity calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
miyunari committed Apr 24, 2022
1 parent 3f9cc29 commit bc1df00
Showing 1 changed file with 2 additions and 23 deletions.
25 changes: 2 additions & 23 deletions api/v1/team/team_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -335,36 +335,15 @@ func (t *TeamService) ListCapacity(w http.ResponseWriter, r *http.Request) {
}
ratio := workDays / daysOfVacation
if ratio > 0.8 {
window.Availability = "LOW"
window.Availability = "HIGH"
} else if ratio <= 0.8 && ratio > 0.25 {
window.Availability = "MEDIUM"
} else {
window.Availability = "HIGH"
window.Availability = "LOW"
}
resp = append(resp, window)
}

resp = []*capacityResponse{
{
From: time.Now().Add(-3 * 24 * time.Hour),
To: time.Now().Add(3 * 24 * time.Hour),
TeamID: "a7da8eb8-410f-4f6a-8324-1db65a289a13",
Availability: "HIGH",
},
{
From: time.Now().Add(-3 * 24 * time.Hour),
To: time.Now().Add(3 * 24 * time.Hour),
TeamID: "e22b2a12-cf42-44c6-a2ed-c3630ba9583a",
Availability: "HIGH",
},
{
From: time.Now().Add(-3 * 24 * time.Hour),
To: time.Now().Add(3 * 24 * time.Hour),
TeamID: "e22b2a12-cf42-44c6-a2ed-c3630ba9583a",
Availability: "HIGH",
},
}

if r.Header.Get("Content-Type") == "application/csv" {
if err := new(capacityResponse).WriteCSVHeader(w); err != nil {
logger.Error(err)
Expand Down

0 comments on commit bc1df00

Please sign in to comment.