importer

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: 12 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-2024 Daniele Rondina <geaaru@gmail.com> 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

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DefaultImporter

type DefaultImporter struct {
	Logger       *log.TmLogger
	Config       *specs.TimeMasterConfig
	TimesheetDir string
	FilePrefix   string
	Opts         ImportOpts
	Timesheets   []specs.AgendaTimesheets
}

func NewDefaultImporter

func NewDefaultImporter(config *specs.TimeMasterConfig, tmDir, filePrefix string, opts ImportOpts) *DefaultImporter

func (*DefaultImporter) AddTimesheet

func (i *DefaultImporter) AddTimesheet(t *specs.AgendaTimesheets)

func (*DefaultImporter) GetTimesheets

func (i *DefaultImporter) GetTimesheets() *[]specs.AgendaTimesheets

func (*DefaultImporter) WriteTimesheets

func (i *DefaultImporter) WriteTimesheets() error

type ImportOpts

type ImportOpts struct {
	SplitResource bool
}

type TimeMasterImporter

type TimeMasterImporter interface {
	LoadTimesheets(string) error
	WriteTimesheets() error
	GetTimesheets() *[]specs.AgendaTimesheets
	AddTimesheet(*specs.AgendaTimesheets)
}

type TmJiraCsvRow

type TmJiraCsvRow struct {
	Issue    string
	Descr    string
	Date     string
	WorkTime string
	User     string
}

type TmJiraImporter

type TmJiraImporter struct {
	*DefaultImporter
	ResourceMapping map[string]string
	IssueTaskMap    map[string]string
	IgnoredIssueMap map[string]bool
	Before202009    bool
	Before202401    bool
}

func NewTmJiraImporter

func NewTmJiraImporter(config *specs.TimeMasterConfig, tmDir, filePrefix string, opts ImportOpts) *TmJiraImporter

func (*TmJiraImporter) GetMappedTask

func (i *TmJiraImporter) GetMappedTask(descr, issue string) (ans string)

func (*TmJiraImporter) GetMappedUser

func (i *TmJiraImporter) GetMappedUser(user string) (ans string)

func (*TmJiraImporter) ImportMapper

func (i *TmJiraImporter) ImportMapper(mapper *TmJiraMapper)

func (*TmJiraImporter) IsIssue2Ignore

func (i *TmJiraImporter) IsIssue2Ignore(issue string) bool

func (*TmJiraImporter) LoadTimesheets

func (i *TmJiraImporter) LoadTimesheets(csvFile string) error

func (*TmJiraImporter) SetBefore202009

func (i *TmJiraImporter) SetBefore202009()

func (*TmJiraImporter) SetBefore202401 added in v0.5.0

func (i *TmJiraImporter) SetBefore202401()

type TmJiraIssue

type TmJiraIssue struct {
	JiraIssue string `json:"jira_issue" yaml:"jira_issue"`
	TaskName  string `json:"task" yaml:"task"`
}

type TmJiraMapper

type TmJiraMapper struct {
	Resources     []TmJiraResource `json:"resources" yaml:"resources"`
	Issues        []TmJiraIssue    `json:"issues" yaml:"issues"`
	IgnoredIssues []string         `json:"ignored_issues,omitempty" yaml:"ignored_issues,omitempty"`
}

func TmJiraMapperFromYaml

func TmJiraMapperFromYaml(data []byte) (*TmJiraMapper, error)

type TmJiraResource

type TmJiraResource struct {
	JiraName string `json:"jira_name" yaml:"jira_name"`
	Name     string `json:"name" yaml:"name"`
}

Jump to

Keyboard shortcuts

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