timecalc

package
v1.4.23 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CalculateExpectedWorkTime

func CalculateExpectedWorkTime(
	ctx context.Context,
	monthlyWorkDays []MonthlyWorkDays,
	workTimes map[string]WorkTimeList,
	from string,
	to string,
) (map[string]ExpectedMonthlyWorkTimeList, error)

func EndOfWeek

func EndOfWeek(t time.Time) time.Time

func StartOfWeek

func StartOfWeek(t time.Time) time.Time

Types

type ExpectedMonthlyWorkTime

type ExpectedMonthlyWorkTime struct {
	Year              int
	Month             time.Month
	TrackedWorkTime   time.Duration
	UntrackedWorkTime time.Duration
}

func (ExpectedMonthlyWorkTime) String

func (mwt ExpectedMonthlyWorkTime) String() string

type ExpectedMonthlyWorkTimeList

type ExpectedMonthlyWorkTimeList []ExpectedMonthlyWorkTime

func (ExpectedMonthlyWorkTimeList) TotalTrackedWorkTime

func (emwtl ExpectedMonthlyWorkTimeList) TotalTrackedWorkTime() time.Duration

func (ExpectedMonthlyWorkTimeList) TotalWorkTime

func (emwtl ExpectedMonthlyWorkTimeList) TotalWorkTime() time.Duration

type MonthlyWorkDays

type MonthlyWorkDays struct {
	Year     int
	Month    time.Month
	WorkDays []int
}

func GatherWorkDaysByMonth

func GatherWorkDaysByMonth(holidays map[string]*calendarv1.PublicHoliday, from, to string) ([]MonthlyWorkDays, error)

func (MonthlyWorkDays) String

func (mwd MonthlyWorkDays) String() string

type PlannedMonthlyWorkTime

type PlannedMonthlyWorkTime struct {
	Year  int
	Month time.Month

	PerUser map[string]*UserTime
}

type PlannedMonthlyWorkTimeList

type PlannedMonthlyWorkTimeList []*PlannedMonthlyWorkTime

func CalculatePlannedMonthlyWorkTime

func CalculatePlannedMonthlyWorkTime(
	ctx context.Context,
	rosters []structs.DutyRoster,
	from string,
	to string,
	workShifts []structs.WorkShift,
	workTimes map[string]WorkTimeList,
) (PlannedMonthlyWorkTimeList, error)

func (PlannedMonthlyWorkTimeList) TotalForUser

func (lst PlannedMonthlyWorkTimeList) TotalForUser(userId string) UserTime

type UserTime

type UserTime struct {
	Tracked   time.Duration
	Untracked time.Duration
}

func (UserTime) HasTracked

func (ut UserTime) HasTracked() bool

func (UserTime) HasUntracked

func (ut UserTime) HasUntracked() bool

func (UserTime) Total

func (ut UserTime) Total() time.Duration

type WorkTimeList

type WorkTimeList []structs.WorkTime

func (WorkTimeList) FindForDate

func (wtl WorkTimeList) FindForDate(t time.Time) (structs.WorkTime, bool)

Jump to

Keyboard shortcuts

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