specs

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2024 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Overview

Copyright (C) 2020 Daniele Rondina <geaaru@sabayonlinux.org> Credits goes also to Gogs authors, some code portions and re-implemented design are also coming from the Gogs project, which is using the go-macaron framework and was really source of ispiration. Kudos to them!

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

Copyright (C) 2020 Daniele Rondina <geaaru@sabayonlinux.org> Credits goes also to Gogs authors, some code portions and re-implemented design are also coming from the Gogs project, which is using the go-macaron framework and was really source of ispiration. Kudos to them!

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

Copyright (C) 2020 Daniele Rondina <geaaru@sabayonlinux.org> Credits goes also to Gogs authors, some code portions and re-implemented design are also coming from the Gogs project, which is using the go-macaron framework and was really source of ispiration. Kudos to them!

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

Copyright (C) 2020 Daniele Rondina <geaaru@sabayonlinux.org> Credits goes also to Gogs authors, some code portions and re-implemented design are also coming from the Gogs project, which is using the go-macaron framework and was really source of ispiration. Kudos to them!

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

Copyright (C) 2020 Daniele Rondina <geaaru@sabayonlinux.org> Credits goes also to Gogs authors, some code portions and re-implemented design are also coming from the Gogs project, which is using the go-macaron framework and was really source of ispiration. Kudos to them!

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

Copyright (C) 2020 Daniele Rondina <geaaru@sabayonlinux.org> Credits goes also to Gogs authors, some code portions and re-implemented design are also coming from the Gogs project, which is using the go-macaron framework and was really source of ispiration. Kudos to them!

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

Copyright (C) 2020 Daniele Rondina <geaaru@sabayonlinux.org> Credits goes also to Gogs authors, some code portions and re-implemented design are also coming from the Gogs project, which is using the go-macaron framework and was really source of ispiration. Kudos to them!

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

Copyright (C) 2020 Daniele Rondina <geaaru@sabayonlinux.org> Credits goes also to Gogs authors, some code portions and re-implemented design are also coming from the Gogs project, which is using the go-macaron framework and was really source of ispiration. Kudos to them!

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

Copyright (C) 2020 Daniele Rondina <geaaru@sabayonlinux.org> Credits goes also to Gogs authors, some code portions and re-implemented design are also coming from the Gogs project, which is using the go-macaron framework and was really source of ispiration. Kudos to them!

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

Copyright (C) 2020 Daniele Rondina <geaaru@sabayonlinux.org> Credits goes also to Gogs authors, some code portions and re-implemented design are also coming from the Gogs project, which is using the go-macaron framework and was really source of ispiration. Kudos to them!

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

Copyright (C) 2020 Daniele Rondina <geaaru@sabayonlinux.org> Credits goes also to Gogs authors, some code portions and re-implemented design are also coming from the Gogs project, which is using the go-macaron framework and was really source of ispiration. Kudos to them!

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

Copyright (C) 2020 Daniele Rondina <geaaru@sabayonlinux.org> Credits goes also to Gogs authors, some code portions and re-implemented design are also coming from the Gogs project, which is using the go-macaron framework and was really source of ispiration. Kudos to them!

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

Copyright (C) 2020 Daniele Rondina <geaaru@sabayonlinux.org> Credits goes also to Gogs authors, some code portions and re-implemented design are also coming from the Gogs project, which is using the go-macaron framework and was really source of ispiration. Kudos to them!

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

Copyright (C) 2020 Daniele Rondina <geaaru@sabayonlinux.org> Credits goes also to Gogs authors, some code portions and re-implemented design are also coming from the Gogs project, which is using the go-macaron framework and was really source of ispiration. Kudos to them!

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

Copyright (C) 2020 Daniele Rondina <geaaru@sabayonlinux.org> Credits goes also to Gogs authors, some code portions and re-implemented design are also coming from the Gogs project, which is using the go-macaron framework and was really source of ispiration. Kudos to them!

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

Index

Constants

View Source
const (
	TM_ENV_PREFIX = "TM"
	TM_CONFIGNAME = ".time-master"
)

Variables

This section is empty.

Functions

func GenDefault

func GenDefault(viper *v.Viper)

Types

type Activity

type Activity struct {
	Name        string `json:"name" yaml:"name"`
	Description string `json:"description,omitempty" yaml:"description,omitempty"`
	Note        string `json:"note,omitempty" yaml:"note,omitempty"`
	Priority    int    `json:"priority" yaml:"priority"`
	File        string `json:"-" yaml:"-"`
	Disabled    bool   `json:"disabled,omitempty" yaml:"disabled,omitempty"`
	Closed      bool   `json:"closed,omitempty" yaml:"closed,omitempty"`

	Offer        int64   `json:"offer,omitempty" yaml:"offer,omitempty"`
	TimeMaterial bool    `json:"time_material,omitempty" yaml:"time_material,omitempty"`
	TMDailyOffer float64 `json:"time_material_daily_offer,omitempty" yaml:"time_material_daily_offer,omitempty"`

	Labels map[string]string `json:"labels,omitempty" yaml:"labels,omitempty"`
	Flags  []string          `json:"flags,omitempty" yaml:"flags,omitempty"`

	Tasks          []Task          `json:"tasks,omitempty" yaml:"tasks,omitempty"`
	ChangeRequests []ChangeRequest `json:"change_requests,omitempty" yaml:"change_requests,omitempty"`
}

func ActivityFromYaml

func ActivityFromYaml(data []byte, file string) (*Activity, error)

func NewActivity

func NewActivity(name, description string) *Activity

func (*Activity) AddTask

func (a *Activity) AddTask(t *Task)

func (*Activity) GetAllTasksList

func (a *Activity) GetAllTasksList() []Task

func (*Activity) GetChangeRequests added in v0.3.0

func (a *Activity) GetChangeRequests() *[]ChangeRequest

func (*Activity) GetLabelValue

func (a *Activity) GetLabelValue(key, dft string) string

func (*Activity) GetOffer

func (a *Activity) GetOffer() int64

func (*Activity) GetPlannedEffortTotSecs

func (a *Activity) GetPlannedEffortTotSecs(workHours int) (int64, error)

func (*Activity) GetTaskByFullName

func (a *Activity) GetTaskByFullName(name string) (*Task, error)

func (*Activity) GetTasks

func (a *Activity) GetTasks() *[]Task

func (*Activity) GetTimeAndMaterialDailyOffer

func (a *Activity) GetTimeAndMaterialDailyOffer() float64

func (*Activity) HasFlag

func (a *Activity) HasFlag(flag string) bool

func (*Activity) HasLabelKey

func (a *Activity) HasLabelKey(key string) bool

func (*Activity) InitDefaultPriority

func (a *Activity) InitDefaultPriority(prio int)

func (*Activity) IsClosed

func (a *Activity) IsClosed() bool

func (*Activity) IsTimeAndMaterial

func (a *Activity) IsTimeAndMaterial() bool

type ActivityReport

type ActivityReport struct {
	*Activity

	RevenuePlan float64 `json:"revenue_plan,omitempty" yaml:"revenue_plan,omitempty"`
	Cost        float64 `json:"cost,omitempty" yaml:"cost,omitempty"`
	Profit      float64 `json:"profit,omitempty" yaml:"profit,omitempty"`

	Work       string `json:"work,omitempty" yaml:"work,omitempty"`
	WorkPerc   string `json:"work_perc,omitempty" yaml:"work_perc,omitempty"`
	Duration   string `json:"duration,omitempty" yaml:"duration,omitempty"`
	ProfitPerc string `json:"profit_perc,omitempty" yaml:"profit_perc,omitempty"`

	BusinessProgressPerc string `json:"business_progress_perc,omitempty" yaml:"business_progress_perc,omitempty"`

	Effort   int64 `json:"effort_sec,omitempty" yaml:"effort_sec,omitempty"`
	WorkSecs int64 `json:"work_sec,omitempty" yaml:"work_sec,omitempty"`
}

func NewActivityReport

func NewActivityReport(a Activity, filtered bool) *ActivityReport

func (*ActivityReport) CalculateDuration

func (a *ActivityReport) CalculateDuration() error

func (*ActivityReport) CalculateProfitPerc

func (a *ActivityReport) CalculateProfitPerc()

func (*ActivityReport) CalculateWorkPerc

func (a *ActivityReport) CalculateWorkPerc()

func (*ActivityReport) GetDuration

func (a *ActivityReport) GetDuration() string

func (*ActivityReport) SetBusinessProgressPerc added in v0.4.0

func (a *ActivityReport) SetBusinessProgressPerc(v string)

func (*ActivityReport) SetCost

func (a *ActivityReport) SetCost(v float64)

func (*ActivityReport) SetEffort

func (a *ActivityReport) SetEffort(v int64)

func (*ActivityReport) SetProfit

func (a *ActivityReport) SetProfit(v float64)

func (*ActivityReport) SetRevenuePlan

func (a *ActivityReport) SetRevenuePlan(v float64)

func (*ActivityReport) SetWork

func (a *ActivityReport) SetWork(v string)

func (*ActivityReport) SetWorkPerc

func (a *ActivityReport) SetWorkPerc(v string)

func (*ActivityReport) SetWorkSecs

func (a *ActivityReport) SetWorkSecs(v int64)

type ActivityResearch

type ActivityResearch struct {
	ClosedActivity     bool
	OnlyClosedActivity bool
	Flags              []string
	Labels             []string
	Clients            []string
	Names              []string
	ExcludeNames       []string
	ExcludeFlags       []string
	LabelsInAnd        bool
}

type AgendaTimesheets

type AgendaTimesheets struct {
	File string `json:"-" yaml:"-"`
	Name string `json:"name,omitempty" yaml:"name,omitempty"`

	Timesheets []ResourceTimesheet `json:"timesheets" yaml:"timesheets"`
}

func AgengaTimesheetFromYaml

func AgengaTimesheetFromYaml(data []byte, file string) (*AgendaTimesheets, error)

func (*AgendaTimesheets) AddResourceTimesheet

func (a *AgendaTimesheets) AddResourceTimesheet(rt *ResourceTimesheet)

func (*AgendaTimesheets) GetLastDateSecs

func (a *AgendaTimesheets) GetLastDateSecs(onlyDate bool) (int64, error)

func (*AgendaTimesheets) GetTimesheets

func (a *AgendaTimesheets) GetTimesheets() *[]ResourceTimesheet

type ChangeRequest added in v0.3.0

type ChangeRequest struct {
	Name          string `json:"name" yaml:"name"`
	Description   string `json:"description,omitempty" yaml:"description,omitempty"`
	Note          string `json:"note,omitempty" yaml:"note,omitempty"`
	PreviousOffer int64  `json:"previous_offer,omitempty" yaml:"previous_offer,omitempty"`
	Offer         int64  `json:"offer,omitempty" yaml:"offer,omitempty"`

	Labels map[string]string `json:"labels,omitempty" yaml:"labels,omitempty"`
	Flags  []string          `json:"flags,omitempty" yaml:"flags,omitempty"`
}

type ChangeRequestReport added in v0.3.0

type ChangeRequestReport struct {
	*ChangeRequest
	ActivityName string `json:"activity,omitempty" yaml:"activity,omitempty"`
}

func NewChangeRequestReport added in v0.3.0

func NewChangeRequestReport(cr *ChangeRequest, activity string) *ChangeRequestReport

type Client

type Client struct {
	Name        string `json:"name" yaml:"name"`
	Description string `json:"description,omitempty" yaml:"description,omitempty"`
	File        string `json:"-" yaml:"-"`

	ActivitiesDirs []string `json:"activities_dirs,omitempty" yaml:"activities_dirs,omitempty"`

	Activities []Activity `json:"activities,omitempty" yaml:"activities,omitempty"`
}

func ClientFromYaml

func ClientFromYaml(data []byte, file string) (*Client, error)

func NewClient

func NewClient(name string) *Client

func (*Client) AddActivity

func (c *Client) AddActivity(a Activity)

func (*Client) GetActivities

func (c *Client) GetActivities() *[]Activity

func (*Client) GetActivityByName

func (c *Client) GetActivityByName(name string) (*Activity, error)

func (*Client) GetName

func (c *Client) GetName() string

type Period

type Period struct {
	StartPeriod string `json:"start_period,omitempty" yaml:"start_period,omitempty"`
	EndPeriod   string `json:"end_period,omitempty" yaml:"end_period,omitempty"`

	StartTime int64 `json:"-" yaml:"-"`
	EndTime   int64 `json:"-" yaml:"-"`
}

type Resource

type Resource struct {
	User  string   `json:"user" yaml:"user"`
	Name  string   `json:"name" yaml:"name"`
	Email []string `json:"email,omitempty" yaml:"email,omitempty"`
	Phone []string `json:"phone,omitempty" yaml:"phone,omitempty"`
	File  string   `json:"-" yaml:"-"`

	Holidays   []ResourceHolidays   `json:"holidays,omitempty" yaml:"holidays,omitempty"`
	Sick       []ResourceSick       `json:"sick,omitempty" yaml:"sick,omitempty"`
	Unemployed []ResourceUnemployed `json:"unemployed,omitempty" yaml:"unemployed,omitempty"`
}

func NewResource

func NewResource(user, name string) *Resource

func ResourceFromYaml

func ResourceFromYaml(data []byte, file string) (*Resource, error)

func (*Resource) AddHoliday

func (r *Resource) AddHoliday(rh ResourceHolidays)

func (*Resource) AddSick

func (r *Resource) AddSick(s ResourceSick)

func (*Resource) AddUnemployed

func (r *Resource) AddUnemployed(ru ResourceUnemployed)

func (*Resource) IsAvailable

func (r *Resource) IsAvailable(workDate string) (bool, error)

func (*Resource) Validate

func (r *Resource) Validate() error

type ResourceCost

type ResourceCost struct {
	*Period `json:"period" yaml:"period"`
	User    string  `json:"user" yaml:"user"`
	Cost    float64 `json:"cost" yaml:"cost"`
}

type ResourceHolidays

type ResourceHolidays struct {
	*Period
}

type ResourceRate

type ResourceRate struct {
	*Period `json:"period" yaml:"period"`
	User    string  `json:"user" yaml:"user"`
	Rate    float64 `json:"rate" yaml:"rate"`
}

type ResourceSick

type ResourceSick struct {
	*Period
}

type ResourceTimesheet

type ResourceTimesheet struct {
	*Period
	User     string `json:"user" yaml:"user"`
	Task     string `json:"task" yaml:"task"`
	Duration string `json:"duration" yaml:"duration"`
	Note     string `json:"note,omitempty" yaml:"note,omitempty"`

	// Internal
	Cost    float64 `json:"cost,omitempty" yaml:"cost,omitempty"`
	Revenue float64 `json:"revenue,omitempty" yaml:"revenue,omitempty"`
}

ResourceTimesheet contains the description of the user timesheet for one single day. Multiple days range aren't supported.

func NewResourceTimesheet

func NewResourceTimesheet(user, startDate, task, duration string) *ResourceTimesheet

func (*ResourceTimesheet) GetDate

func (rt *ResourceTimesheet) GetDate(onlyDate bool) (string, error)

func (*ResourceTimesheet) GetDateUnix

func (rt *ResourceTimesheet) GetDateUnix(onlyDate bool) (int64, error)

func (*ResourceTimesheet) GetMapKey

func (rt *ResourceTimesheet) GetMapKey(opts TimesheetResearch, onlyDate bool) (string, error)

func (*ResourceTimesheet) GetMonth

func (rt *ResourceTimesheet) GetMonth(onlyDate bool) (string, error)

func (*ResourceTimesheet) GetSeconds

func (rt *ResourceTimesheet) GetSeconds(workHours int) (int64, error)

func (*ResourceTimesheet) ResolveActivityByName

func (rt *ResourceTimesheet) ResolveActivityByName() string

func (*ResourceTimesheet) SetCost

func (rt *ResourceTimesheet) SetCost(c float64)

func (*ResourceTimesheet) SetRevenue

func (rt *ResourceTimesheet) SetRevenue(r float64)

type ResourceTsAggregated

type ResourceTsAggregated struct {
	*Period
	User     string `json:"user,omitempty" yaml:"user,omitempty"`
	Task     string `json:"task,omitempty" yaml:"task,omitempty"`
	Duration string `json:"duration" yaml:"duration"`
	Seconds  int64  `json:"-" yaml:"-"`

	Cost    float64 `json:"cost,omitempty" yaml:"cost,omitempty"`
	Revenue float64 `json:"revenue,omitempty" yaml:"revenue,omitempty"`
}

func NewResourceTsAggregated

func NewResourceTsAggregated(date, user, task string) *ResourceTsAggregated

func (*ResourceTsAggregated) AddResourceTimesheet

func (rta *ResourceTsAggregated) AddResourceTimesheet(rt *ResourceTimesheet, workHours int) error

func (*ResourceTsAggregated) CalculateDuration

func (rta *ResourceTsAggregated) CalculateDuration() (ans error)

func (*ResourceTsAggregated) GetCost

func (rta *ResourceTsAggregated) GetCost() float64

func (*ResourceTsAggregated) GetDuration

func (rta *ResourceTsAggregated) GetDuration() string

func (*ResourceTsAggregated) GetRevenue

func (rta *ResourceTsAggregated) GetRevenue() float64

func (*ResourceTsAggregated) GetSeconds

func (rta *ResourceTsAggregated) GetSeconds() int64

type ResourceUnemployed

type ResourceUnemployed struct {
	*Period
}

type Scenario

type Scenario struct {
	Name        string `json:"name" yaml:"name"`
	Description string `json:"description,omitempty" yaml:"description,omitempty"`
	File        string `json:"-" yaml:"-"`

	ResourceCosts []ResourceCost `json:"resources_cost,omitempty" yaml:"resources_cost,omitempty"`
	Rates         []ResourceRate `json:"rates,omitempty" yaml:"rates,omitempty"`

	NowTime string `json:"now,omitempty" yaml:"now,omitempty"`

	Scheduler string `json:"scheduler,omitempty" yaml:"scheduler,omitempty"`

	// For scheduler simple
	Tasks      []ScenarioTask     `json:"task_prorities,omitempty" yaml:"task_prorities,omitempty"`
	Activities []ScenarioActivity `json:"activities_priorities,omitempty" yaml:"activities_priorities,omitempty"`
}

func ScenarioFromYaml

func ScenarioFromYaml(data []byte, file string) (*Scenario, error)

func (*Scenario) GetResourceCost4Date

func (s *Scenario) GetResourceCost4Date(dstr, resourceUser string) (float64, error)

func (*Scenario) GetResourceRate4Date

func (s *Scenario) GetResourceRate4Date(dstr, resourceUser string) (float64, error)

func (*Scenario) SetNow

func (s *Scenario) SetNow(n string)

type ScenarioActivity

type ScenarioActivity struct {
	Name     string `json:"name" yaml:"name"`
	Priority int    `json:"priority" yaml:"priority"`
}

type ScenarioSchedule

type ScenarioSchedule struct {
	*Scenario
	File string `json:"-" yaml:"-"`

	Schedule []TaskScheduled `json:schedule,omitempty yaml:"schedule,omitempty`
}

func ScenarioScheduleFromFile

func ScenarioScheduleFromFile(file string) (*ScenarioSchedule, error)

func ScenarioScheduleFromYaml

func ScenarioScheduleFromYaml(data []byte, file string) (*ScenarioSchedule, error)

func (*ScenarioSchedule) GetAllResourceTimesheets

func (s *ScenarioSchedule) GetAllResourceTimesheets() *AgendaTimesheets

func (*ScenarioSchedule) Write2File

func (s *ScenarioSchedule) Write2File(f string) error

type ScenarioTask

type ScenarioTask struct {
	Name     string `json:"name" yaml:"name"`
	Priority int    `json:"priority" yaml:"priority"`

	OverrideResource []string `json:"override_resources,omitempty" yaml:"override_resources,omitempty"`
}

type Task

type Task struct {
	*Period

	Name        string `json:"name" yaml:"name"`
	Description string `json:"description,omitempty" yaml:"description,omitempty"`
	Note        string `json:"note,omitempty" yaml:"note,omitempty"`
	Priority    int    `json:"priority,omitempty" yaml:"priority,omitempty"`
	Effort      string `json:"effort,omitempty" yaml:"effort,omitempty"`
	Completed   bool   `json:"completed,omitempty" yaml:"completed,omitempty"`

	AllocatedResource []string `json:"resources,omitempty" yaml:"resources,omitempty"`

	Milestone string `json:"milestone,omitempty" yaml:"milestone,omitempty"`

	Flags  []string          `json:"flags,omitempty" yaml:"flags,omitempty"`
	Labels map[string]string `json:"labels,omitempty" yaml:"labels,omitempty"`

	Tasks   []Task   `json:"subtasks,omitempty" yaml:"subtasks,omitempty"`
	Depends []string `json:"depends,omitempty" yaml:"depends,omitempty"`

	// Recursive options
	Recursive TaskRecursiveOpts `json:"recursive,omitempty" yaml:"recursive,omitempty"`
}

General task structure for files specs

func NewTask

func NewTask(name, description, effort string, resources []string) *Task

func (*Task) Clone

func (t *Task) Clone(filtered bool) *Task

func (*Task) GetAllTasksAndSubTasksList

func (t *Task) GetAllTasksAndSubTasksList(fatherName string, fatherResources []string, fatherIsCompleted bool) []Task

func (*Task) GetEffort

func (t *Task) GetEffort() string

func (*Task) GetEffortSeconds

func (t *Task) GetEffortSeconds(workHours int) (int64, error)

func (*Task) GetPlannedEffortTotSecs

func (t *Task) GetPlannedEffortTotSecs(workHours int) (int64, error)

func (*Task) GetSubTasks

func (t *Task) GetSubTasks() *[]Task

func (*Task) GetTaskByFullName

func (t *Task) GetTaskByFullName(fullname string) (*Task, error)

func (*Task) HasFlag

func (t *Task) HasFlag(flag string) bool

func (*Task) HasLabelKey

func (t *Task) HasLabelKey(key string) bool

func (*Task) InitDefaultPriority

func (t *Task) InitDefaultPriority(prio int)

func (*Task) IsCompleted

func (t *Task) IsCompleted() bool

func (*Task) Validate

func (t *Task) Validate(ignoreError bool) error

type TaskRecursiveOpts

type TaskRecursiveOpts struct {
	Enable bool `json:"enable" yaml:"enable"`
	// Type of recursion: weekly (default) | monthly | daily
	Mode     string `json:"mode,omitempty" yaml:"mode,omitempty"`
	Duration string `json:"duration,omitempty" yaml:"duration,omitempty"`

	Exclude []Period `json:"exclude,omitempty" yaml:"exclude,omitempty"`
}

func (*TaskRecursiveOpts) GetDuration

func (ts *TaskRecursiveOpts) GetDuration() string

func (*TaskRecursiveOpts) GetMode

func (ts *TaskRecursiveOpts) GetMode() string

func (*TaskRecursiveOpts) GetSeconds

func (ts *TaskRecursiveOpts) GetSeconds(workHours int) (int64, error)

func (*TaskRecursiveOpts) IsAvailable

func (ts *TaskRecursiveOpts) IsAvailable(workDate string) (bool, error)

type TaskReport

type TaskReport struct {
	*Task `json:"task,omitempty" yaml:"task,omitempty"`

	Name        string  `json:"name" yaml:"name"`
	Description string  `json:"description,omitempty" yaml:"description,omitempty"`
	Work        string  `json:"work,omitempty" yaml:"work,omitempty"`
	WorkSec     int64   `json:"work_sec,omitempty" yaml:"work_sec,omitempty"`
	Effort      string  `json:"effort" yaml:"effort"`
	EffortSec   int64   `json:"effort_sec" yaml:"effort_sec"`
	Cost        float64 `json:"cost,omitempty" yaml:"cost,omitempty"`
}

type TaskResearch

type TaskResearch struct {
	ClosedActivity     bool
	OnlyClosedActivity bool
	Milestone          bool
	OnlyMilestone      bool
	WithEffort         bool
	Users              []string
	Flags              []string
	ActivityFlags      []string
	Labels             []string
	ActivityLabels     []string
	Tasks              []string
	Clients            []string
	ExcludeFlags       []string
}

type TaskSchedPrioritySorter

type TaskSchedPrioritySorter []TaskScheduled

func (TaskSchedPrioritySorter) Len

func (t TaskSchedPrioritySorter) Len() int

func (TaskSchedPrioritySorter) Less

func (t TaskSchedPrioritySorter) Less(i, j int) bool

func (TaskSchedPrioritySorter) Swap

func (t TaskSchedPrioritySorter) Swap(i, j int)

type TaskScheduled

type TaskScheduled struct {
	*Task
	*Period

	// We don't need this on yaml because could be stored with clients
	Activity *Activity `json:"-" yaml:"-"`
	Client   *Client   `json:"client" yaml:"client"`

	Progress float64 `json:"progress,omitempty" yaml:"progress,omitempty"`
	WorkTime int64   `json:"work_time,omitempty" yaml:"work_time,omitempty"`
	LeftTime int64   `json:"-" yaml:"-"`

	Underestimated bool `json:"understimated,omitempty" yaml:"understimated,omitempty"`

	Timesheets []ResourceTimesheet `json:"timesheets,omitempty" yaml:"timesheets,omitempty"`
}

func (*TaskScheduled) AddTimesheet

func (t *TaskScheduled) AddTimesheet(rt *ResourceTimesheet)

func (*TaskScheduled) ElaborateTimesheets

func (t *TaskScheduled) ElaborateTimesheets(onlyDate bool, workHours int, withPlan bool) error

type TimeMasterConfig

type TimeMasterConfig struct {
	Viper *v.Viper `yaml:"-" json:"-"`

	General TimeMasterConfigGeneral `mapstructure:"general" json:"general,omitempty" yaml:"general,omitempty"`
	Logging TimeMasterConfigLogging `mapstructure:"logging" json:"logging,omitempty" yaml:"logging,omitempty"`

	Work TimeMasterConfigWork `mapstructure:"work,omitempty" json:"work,omitempty" yaml:"work,omitempty"`

	ClientsDirs []string `mapstructure:"clients_dirs,omitempty" json:"clients_dirs,omitempty" yaml:"clients_dirs,omitempty"`

	ResourcesDirs []string `mapstructure:"resources_dirs,omitempty" json:"resources_dirs,omitempty" yaml:"resources_dirs,omitempty"`

	ScenariosDirs []string `mapstructure:"scenarios_dirs,omitempty" json:"scenarios_dirs,omitempty" yaml:"scenarios_dirs,omitempty"`

	TimesheetsDirs []string `mapstructure:"timesheets_dirs,omitempty" json:"timesheets_dirs,omitempty" yaml:"timesheets_dirs,omitempty"`
}

func NewTimeMasterConfig

func NewTimeMasterConfig(viper *v.Viper) *TimeMasterConfig

func (*TimeMasterConfig) GetClientsDirs

func (c *TimeMasterConfig) GetClientsDirs() []string

func (*TimeMasterConfig) GetGeneral

func (c *TimeMasterConfig) GetGeneral() *TimeMasterConfigGeneral

func (*TimeMasterConfig) GetLogging

func (c *TimeMasterConfig) GetLogging() *TimeMasterConfigLogging

func (*TimeMasterConfig) GetResourcesDirs

func (c *TimeMasterConfig) GetResourcesDirs() []string

func (*TimeMasterConfig) GetScenariosDirs

func (c *TimeMasterConfig) GetScenariosDirs() []string

func (*TimeMasterConfig) GetTimesheetsDirs

func (c *TimeMasterConfig) GetTimesheetsDirs() []string

func (*TimeMasterConfig) GetWork

func (c *TimeMasterConfig) GetWork() *TimeMasterConfigWork

func (*TimeMasterConfig) Unmarshal

func (c *TimeMasterConfig) Unmarshal() error

func (*TimeMasterConfig) Yaml

func (c *TimeMasterConfig) Yaml() ([]byte, error)

type TimeMasterConfigGeneral

type TimeMasterConfigGeneral struct {
	Debug bool `mapstructure:"debug,omitempty" json:"debug,omitempty" yaml:"debug,omitempty"`
}

func (*TimeMasterConfigGeneral) HasDebug

func (g *TimeMasterConfigGeneral) HasDebug() bool

type TimeMasterConfigLogging

type TimeMasterConfigLogging struct {
	// Path of the logfile
	Path string `mapstructure:"path,omitempty" json:"path,omitempty" yaml:"path,omitempty"`
	// Enable/Disable logging to file
	EnableLogFile bool `mapstructure:"enable_logfile,omitempty" json:"enable_logfile,omitempty" yaml:"enable_logfile,omitempty"`
	// Enable JSON format logging in file
	JsonFormat bool `mapstructure:"json_format,omitempty" json:"json_format,omitempty" yaml:"json_format,omitempty"`

	// Log level
	Level string `mapstructure:"level,omitempty" json:"level,omitempty" yaml:"level,omitempty"`

	// Enable emoji
	EnableEmoji bool `mapstructure:"enable_emoji,omitempty" json:"enable_emoji,omitempty" yaml:"enable_emoji,omitempty"`
	// Enable/Disable color in logging
	Color bool `mapstructure:"color,omitempty" json:"color,omitempty" yaml:"color,omitempty"`
}

type TimeMasterConfigWork

type TimeMasterConfigWork struct {
	// Default number of hours for day
	WorkHours           int `mapstructure:"work_hours,omitempty" json:"work_hours,omitempty" yaml:"work_hours,omitempty"`
	TaskDefaultPriority int `mapstructure:"task_default_priority,omitempty" json:"task_default_priority,omitempty" yaml:"task_default_priority,omitempty"`
}

type TimesheetReport

type TimesheetReport struct {
	User      string `json:"user,omitempty" yaml:"user,omitempty"`
	Date      string `json:"date,omitempty" yaml:"date,omitempty"`
	Task      string `json:"task,omitempty" yaml:"task,omitempty"`
	Activity  string `json:"activity,omitempty" yaml:"activity,omitempty"`
	Effort    string `json:"effort,omitempty" yaml:"effort,omitempty"`
	EffortSec int64  `json:"effort_sec,omitempty" yaml:"effort_sec,omitempty"`
}

type TimesheetReportEvent

type TimesheetReportEvent struct {
	Date      string `json:"date" yaml:"date"`
	Effort    string `json:"effort" yaml:"effort"`
	EffortSec int64  `json:"effort_sec" yaml:"effort_sec"`
}

type TimesheetReportPerUser

type TimesheetReportPerUser struct {
	User         string                 `json:"user,omitempty" yaml:"user,omitempty"`
	Events       []TimesheetReportEvent `json:"events,omitempty", yaml:"events,omitempty"`
	TotEffortSec int64                  `json:"tot_effort_sec,omitempty" yaml:"tot_effort_sec,omitempty"`
	TotEffort    string                 `json:"tot_effort,omitempty" yaml:"tot_effort,omitempty"`
}

type TimesheetResearch

type TimesheetResearch struct {
	ByUser     bool
	ByTask     bool
	ByActivity bool
	Monthly    bool
	IgnoreTime bool
}

Jump to

Keyboard shortcuts

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