Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
berlam committed Oct 4, 2019
1 parent ea41562 commit b549fc4
Show file tree
Hide file tree
Showing 8 changed files with 9 additions and 42 deletions.
4 changes: 0 additions & 4 deletions cmd/add.go
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
package cmd

import (
"eager/internal"
"github.com/spf13/cobra"
)

func init() {
// TODO mro Reactivate that command after implementing it
//rootCmd.AddCommand(addCmd)
addCmd.AddCommand(addJiraCmd)

addCmd.PersistentFlags().Bool(internal.FlagAll, false, "Add all items to the backend")
addCmd.PersistentFlags().Bool(internal.FlagForce, false, "Overwrite existing values")
}

var addCmd = &cobra.Command{
Expand Down
27 changes: 0 additions & 27 deletions cmd/push.go

This file was deleted.

2 changes: 0 additions & 2 deletions internal/configuration.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ const (
FlagEmpty = "empty"
FlagDecimal = "decimal"
FlagNegate = "negate"
FlagAll = "all"
FlagForce = "force"
)

type Configuration struct {
Expand Down
4 changes: 2 additions & 2 deletions pkg/csv.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,14 +193,14 @@ func (ts Timesheet) WriteCsv(writer io.Writer, spec *CsvSpecification, opts *int
}

currentUser := ts[0].User
currentDate := time.Date(ts[0].Date.Year(), time.Month(ts[0].Date.Month()), 1, 0, 0, 0, 0, time.UTC)
currentDate := time.Date(ts[0].Date.Year(), ts[0].Date.Month(), 1, 0, 0, 0, 0, time.UTC)
for _, effort := range ts {
if currentUser != nil && currentUser.DisplayName != effort.User.DisplayName {
if currentDate.Day() > 1 {
emptyLinesForDaysBetween(csvw, spec, currentDate, currentDate.AddDate(0, 1, 1-currentDate.Day()), currentUser, opts.Decimal)
}
currentUser = effort.User
currentDate = time.Date(effort.Date.Year(), time.Month(effort.Date.Month()), 1, 0, 0, 0, 0, time.UTC)
currentDate = time.Date(effort.Date.Year(), effort.Date.Month(), 1, 0, 0, 0, 0, time.UTC)
}
if opts.Empty {
emptyLinesForDaysBetween(csvw, spec, currentDate, effort.Date, effort.User, opts.Decimal)
Expand Down
2 changes: 1 addition & 1 deletion pkg/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,6 @@ func (f RoundTripFunc) RoundTrip(req *http.Request) (*http.Response, error) {

func NewTestClient(fn RoundTripFunc) *http.Client {
return &http.Client{
Transport: RoundTripFunc(fn),
Transport: fn,
}
}
2 changes: 1 addition & 1 deletion pkg/jira/jira.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ func do(api model.Api, year int, month time.Month, projects []pkg.Project, accou
effort <- pkg.Effort{
User: user,
Description: worklog.Comment(),
Project: pkg.Project(issue.Project()),
Project: issue.Project(),
Task: pkg.Task(issue.Key()),
Date: date,
Duration: worklog.Duration(),
Expand Down
6 changes: 3 additions & 3 deletions pkg/jira/model/jql.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func (query Jql) Projects(projects ...pkg.Project) Jql {
for i, project := range projects {
result[i] = string(project)
}
return Jql(append(query, fmt.Sprintf(jqlWorklogProject, strings.Join(result, "','"))))
return append(query, fmt.Sprintf(jqlWorklogProject, strings.Join(result, "','")))
}

func (query Jql) Users(users ...Account) Jql {
Expand All @@ -34,11 +34,11 @@ func (query Jql) Users(users ...Account) Jql {
for i, user := range users {
result[i] = string(user)
}
return Jql(append(query, fmt.Sprintf(jqlWorklogAuthor, "'"+strings.Join(result, "','")+"'")))
return append(query, fmt.Sprintf(jqlWorklogAuthor, "'"+strings.Join(result, "','")+"'"))
}

func (query Jql) Between(fromDate, toDate time.Time) Jql {
return Jql(append(query, fmt.Sprintf(jqlWorklogDate, fromDate.Format(pkg.IsoYearMonthDaySlash), toDate.Format(pkg.IsoYearMonthDaySlash))))
return append(query, fmt.Sprintf(jqlWorklogDate, fromDate.Format(pkg.IsoYearMonthDaySlash), toDate.Format(pkg.IsoYearMonthDaySlash)))
}

func (query Jql) Build() string {
Expand Down
4 changes: 2 additions & 2 deletions pkg/jira/v2/api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ func addProject(host string, port nat.Port) projectKey {
Key projectKey `json:"key"`
}
data, _ := ioutil.ReadAll(response.Body)
_ = json.Unmarshal(data, result)
_ = json.Unmarshal(data, &result)
return result.Key
}

Expand Down Expand Up @@ -129,7 +129,7 @@ func addIssue(host string, port nat.Port, key projectKey) model.IssueKey {
Key model.IssueKey `json:"key"`
}
data, _ := ioutil.ReadAll(response.Body)
_ = json.Unmarshal(data, result)
_ = json.Unmarshal(data, &result)
return result.Key
}

Expand Down

0 comments on commit b549fc4

Please sign in to comment.