timesheet

package
v0.0.0-...-c46dd1d Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2021 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Calendar

type Calendar struct {
	// contains filtered or unexported fields
}

func NewCalendar

func NewCalendar(leave configDateParser, weekend configDateParser, publicHoliday configDateParser, l log.Logger) Calendar

func (*Calendar) BuildTimesheet

func (c *Calendar) BuildTimesheet(cfg Config) []Day

type Config

type Config struct {
	SelectedYear        int
	SelectedMonth       int
	SelectedProjectID   int
	LeaveDays           string
	IgnorePublicHoliday bool
	ArniaProjectID      int
}

type Day

type Day struct {
	Date      time.Time
	ProjectID int
	Status    dayStatus
}

type Holidays

type Holidays []struct {
	Date        string      `json:"date"`
	LocalName   string      `json:"localName"`
	Name        string      `json:"name"`
	CountryCode string      `json:"countryCode"`
	Fixed       bool        `json:"fixed"`
	Global      bool        `json:"global"`
	Counties    interface{} `json:"counties"`
	LaunchYear  interface{} `json:"launchYear"`
	Type        string      `json:"type"`
}

Holidays models the response of https://date.nager.at/api/v2/PublicHolidays/2021/RO

type Leave

type Leave struct {
	// contains filtered or unexported fields
}

func (*Leave) GetDates

func (l *Leave) GetDates() []int

func (*Leave) HasDate

func (l *Leave) HasDate(d int) bool

func (*Leave) Parse

func (l *Leave) Parse(cfg Config, ldom int)

Parse the flag input from the main command

type PublicHoliday

type PublicHoliday struct {
	// contains filtered or unexported fields
}

func NewPublicHoliday

func NewPublicHoliday(api PublicHolidayAPI, logger log.Logger) *PublicHoliday

func (*PublicHoliday) GetDates

func (l *PublicHoliday) GetDates() []int

func (*PublicHoliday) HasDate

func (ph *PublicHoliday) HasDate(d int) bool

func (*PublicHoliday) Parse

func (ph *PublicHoliday) Parse(cfg Config, ldom int)

Parse processes the data from the API into a slice of day-dates of public holidays

type PublicHolidayAPI

type PublicHolidayAPI struct {
	// contains filtered or unexported fields
}

func NewPublicHolidayAPI

func NewPublicHolidayAPI(logger log.Logger) *PublicHolidayAPI

func (*PublicHolidayAPI) Fetch

func (api *PublicHolidayAPI) Fetch(year int) Holidays

Fetch handles the low-level fetching on the API

type Weekend

type Weekend struct {
	// contains filtered or unexported fields
}

func (*Weekend) GetDates

func (l *Weekend) GetDates() []int

func (*Weekend) HasDate

func (w *Weekend) HasDate(d int) bool

func (*Weekend) Parse

func (w *Weekend) Parse(cfg Config, ldom int)

ParseStr

Jump to

Keyboard shortcuts

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