harvest

package
v1.9.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 16, 2020 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckEnvVariables

func CheckEnvVariables() error

func Group

func Group(verboseFlag bool, outputFlag string) error

func HttpGet

func HttpGet(url string, account_id string, token string) ([]byte, error)

Types

type CSVFormatter added in v1.8.0

type CSVFormatter struct {
	Stats *Stats
}

func NewCSVFormatter added in v1.8.0

func NewCSVFormatter(stats *Stats) *CSVFormatter

func (*CSVFormatter) Output added in v1.8.0

func (f *CSVFormatter) Output()

type OutputFormat added in v1.8.0

type OutputFormat uint32
const (
	TextOutputFormat OutputFormat = iota
	CSVOutputFormat
)

type Project added in v1.2.0

type Project struct {
	Id   int
	Name string
}

type Report added in v1.7.0

type Report struct {
	TimeEntries []TimeEntry
	// contains filtered or unexported fields
}

func NewReport added in v1.7.0

func NewReport(timeEntries []TimeEntry) Report

func (*Report) Run added in v1.7.0

func (r *Report) Run()

func (*Report) Stats added in v1.7.0

func (r *Report) Stats() *Stats

type ReportInterface added in v1.8.0

type ReportInterface interface {
	Output()
}

type Result added in v1.6.0

type Result struct {
	GroupedByTag map[string]float64
}

type Stats added in v1.7.0

type Stats struct {
	GroupedByTag map[string]float64
	// contains filtered or unexported fields
}

func NewStats added in v1.7.0

func NewStats(grouped_by_tags map[string]float64) *Stats

func (*Stats) PercentageForTag added in v1.7.0

func (s *Stats) PercentageForTag(tag string) float64

Returns percentage for total hours.

The hard part is to calculate percentage values so that the summed up percentages are not higher than 100%. See for example https://revs.runtime-revolution.com/getting-100-with-rounded-percentages-273ffa70252b Let's go with a simple solution that can calculate sum(percentages) > 100%.

func (*Stats) TotalHours added in v1.7.0

func (s *Stats) TotalHours() float64

type Task added in v1.9.0

type Task struct {
	Id   int
	Name string
}

type TextFormatter added in v1.6.0

type TextFormatter struct {
	Stats *Stats
}

func NewTextFormatter added in v1.6.0

func NewTextFormatter(stats *Stats) *TextFormatter

func (*TextFormatter) Output added in v1.6.0

func (f *TextFormatter) Output()

type TimeEntriesPage added in v1.9.0

type TimeEntriesPage struct {
	TimeEntries []TimeEntry `json:"time_entries"`
	NextPage    *int        `json:"next_page"`
}

type TimeEntry

type TimeEntry struct {
	Id        int
	Hours     float64
	Notes     string
	Project   Project
	User      User
	Task      Task
	SpentDate string `json:"spent_date"`
}

type User added in v1.3.0

type User struct {
	Id   int
	Name string
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL