Documentation ¶
Index ¶
Constants ¶
const TeamworkTimeShort = "20060102"
TeamworkTimeShort represents a Teamwork date in short form.
const UnanetTimeShort = "1/2/2006"
UnanetTimeShort represents a Unanet date in short form.
Variables ¶
This section is empty.
Functions ¶
func ConvertUnanetDate ¶
ConvertUnanetDate converts Unanet short format (MM/DD/YYYY) into Teamwork API short format (YYYYMMDD).
Types ¶
type Report ¶
type Report struct { Filename string Name string `json:"reportName"` Fields []string `json:"columns"` FieldIndex map[string]int CompanyMappings map[string]string `json:"companyMappings"` ProjectMappings map[string]string `json:"projectMappings"` TaskMappings map[string]string `json:"taskMappings"` UserMappings map[string]string `json:"userMappings"` Connection *teamworkapi.Connection }
Report models a Unanet time report. Fields represents the required columns in the .csv file. FieldIndex maps each field to its respective column number in the .csv file.
func NewReport ¶
func NewReport(conn *teamworkapi.Connection) (*Report, error)
NewReport creates a new Report instance and initializes the Connection to Teamwork API.
func (*Report) LoadConfig ¶
LoadConfig configures a Report based on json file.
func (*Report) VerifyColumns ¶
VerifyColumns performs a sanity check to ensure the comma-separated string columns includes all required columns.
type TimeDetailsReport ¶
type TimeDetailsReport struct { Report *Report Entries []*teamworkapi.TimeEntry StartDate time.Time EndDate time.Time }
TimeDetailsReport models a specific type of Unanet report - the Person Time Details report.
func NewTimeDetailsReport ¶
func NewTimeDetailsReport(conn *teamworkapi.Connection) (*TimeDetailsReport, error)
NewTimeDetailsReport creates a new TimeDetailsReport and initializes the underlying parent Report object with the specific teamworkapi.Connection.
func (*TimeDetailsReport) ParseTimeDetailsReport ¶
func (r *TimeDetailsReport) ParseTimeDetailsReport(path string) ([]*teamworkapi.TimeEntry, error)
ParseTimeDetailsReport converts Unanet time report into an array of TimeEntry objects and updates the TimeDetailsReport with applicable metadata, including the TimeEntry array, and start/end date of report.
func (*TimeDetailsReport) UploadTimeEntries ¶
func (r *TimeDetailsReport) UploadTimeEntries() error
UploadTimeEntries uploads the time entries is the TimeDetailsReport to Teamwork. A new file is created that includes all the original data from the Unanet report, plus a new column TeamworkTimeEntryID that maps the Unanet time log to a Teamwork Time Entry. The new file is saved with the naming convention, time-details-report_YYYYMMDD-YYYYMMDD.csv.