Documentation ¶
Overview ¶
Package reporting provides functionality for creating reports from Glass Factory data
Index ¶
- func FormatBillableStatus(billableStatus model.BillableStatus) string
- type AnnualTimeReport
- type AnnualTimeReportTableWriter
- type ByCalendarMonth
- type ByClient
- type ByFiscalYear
- type CalendarMonth
- type FiscalYear
- type FiscalYearMemberTimeReport
- type FiscalYearTimeReport
- type FiscalYearTimeReportTableWriter
- type MonthlyMemberTimeReport
- type MonthlyTimeReport
- type MonthlyTimeReportTableWriter
- type ProjectMemberTimeReport
- type Service
- type TimeReportTotals
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FormatBillableStatus ¶
func FormatBillableStatus(billableStatus model.BillableStatus) string
FormatBillableStatus returns the BillableStatus field as a string
Types ¶
type AnnualTimeReport ¶
type AnnualTimeReport struct { Year int Client *model.Client Project *model.Project Planned float64 Actual float64 }
AnnualTimeReport represents a project time report for a calendar year
func (*AnnualTimeReport) BillableStatus ¶
func (r *AnnualTimeReport) BillableStatus() string
BillableStatus formats project billable status as a string
type AnnualTimeReportTableWriter ¶
type AnnualTimeReportTableWriter struct {
// contains filtered or unexported fields
}
AnnualTimeReportTableWriter is used for printing annual time reports
func NewAnnualTimeReportTableWriter ¶
func NewAnnualTimeReportTableWriter(writer io.Writer) *AnnualTimeReportTableWriter
NewAnnualTimeReportTableWriter creates writer for annual time reports
func (*AnnualTimeReportTableWriter) Append ¶
func (t *AnnualTimeReportTableWriter) Append(r *AnnualTimeReport)
Append adds annual time report data to the report
func (*AnnualTimeReportTableWriter) Render ¶
func (t *AnnualTimeReportTableWriter) Render()
Render the annual time report data
type ByCalendarMonth ¶
type ByCalendarMonth []*MonthlyMemberTimeReport
ByCalendarMonth implements sort.Interface based on the CalendarMonth field.
func (ByCalendarMonth) Len ¶
func (a ByCalendarMonth) Len() int
func (ByCalendarMonth) Less ¶
func (a ByCalendarMonth) Less(i, j int) bool
func (ByCalendarMonth) Swap ¶
func (a ByCalendarMonth) Swap(i, j int)
type ByClient ¶
type ByClient []*ProjectMemberTimeReport
ByClient implements sort.Interface based on the Client.ID field.
type ByFiscalYear ¶
type ByFiscalYear []*FiscalYearMemberTimeReport
ByFiscalYear implements sort.Interface based on the FiscalYear field.
func (ByFiscalYear) Len ¶
func (a ByFiscalYear) Len() int
func (ByFiscalYear) Less ¶
func (a ByFiscalYear) Less(i, j int) bool
func (ByFiscalYear) Swap ¶
func (a ByFiscalYear) Swap(i, j int)
type CalendarMonth ¶
type CalendarMonth struct { Year int // Year (e.g., 2014). Month time.Month // Month of the year (January = 1, ...). }
CalendarMonth represents a calendar month
func (CalendarMonth) After ¶
func (m CalendarMonth) After(m2 CalendarMonth) bool
After reports whether m occurs after m2.
func (CalendarMonth) Before ¶
func (m CalendarMonth) Before(m2 CalendarMonth) bool
Before reports whether m occurs before m2.
func (CalendarMonth) String ¶
func (m CalendarMonth) String() string
String returns the month in YYYY-MM format.
type FiscalYear ¶
FiscalYear represents a time range for a fiscal year
func NewFiscalYear ¶
func NewFiscalYear(d time.Time, finalMonth time.Month) *FiscalYear
NewFiscalYear returns new FiscalYear for the given date ending at the given month
func (FiscalYear) After ¶
func (fy FiscalYear) After(fy2 FiscalYear) bool
After reports whether fy occurs after fy2.
func (FiscalYear) Before ¶
func (fy FiscalYear) Before(fy2 FiscalYear) bool
Before reports whether fy occurs before fy2.
func (FiscalYear) String ¶
func (fy FiscalYear) String() string
String returns the fiscal year in FY YYYY format.
type FiscalYearMemberTimeReport ¶
type FiscalYearMemberTimeReport struct { UserID int FiscalYear FiscalYear Start dateutil.Date End dateutil.Date Reports []*model.MemberTimeReport }
FiscalYearMemberTimeReport represents MemberTimeReport data for a given fiscal year
func FiscalYearMemberTimeReports ¶
func FiscalYearMemberTimeReports(reports []*model.MemberTimeReport, finalMonth time.Month) []*FiscalYearMemberTimeReport
FiscalYearMemberTimeReports convers MemberTimeReport data into FiscalYearMemberTimeReport
func NewFiscalYearMemberTimeReport ¶
func NewFiscalYearMemberTimeReport(userID int, fy FiscalYear) *FiscalYearMemberTimeReport
NewFiscalYearMemberTimeReport creates FiscalYearMemberTimeReport for a user and given fiscal year
func (*FiscalYearMemberTimeReport) Actual ¶
func (tr *FiscalYearMemberTimeReport) Actual() float64
Actual returns total actual hours
func (*FiscalYearMemberTimeReport) Append ¶
func (tr *FiscalYearMemberTimeReport) Append(r *model.MemberTimeReport)
Append a MemberTimeReport to the FiscalYearMemberTimeReport
func (*FiscalYearMemberTimeReport) Planned ¶
func (tr *FiscalYearMemberTimeReport) Planned() float64
Planned returns total planned hours
func (*FiscalYearMemberTimeReport) RenderTable ¶
func (tr *FiscalYearMemberTimeReport) RenderTable(writer io.Writer)
RenderTable displays FiscalYearMemberTimeReport in using NewFiscalYearTimeReportTableWriter
type FiscalYearTimeReport ¶
type FiscalYearTimeReport struct { FiscalYear FiscalYear Client *model.Client Project *model.Project Planned float64 Actual float64 }
FiscalYearTimeReport represents fiscal year totals for a given client and project
func (*FiscalYearTimeReport) BillableStatus ¶
func (r *FiscalYearTimeReport) BillableStatus() string
BillableStatus returns project's billable status
type FiscalYearTimeReportTableWriter ¶
type FiscalYearTimeReportTableWriter struct {
// contains filtered or unexported fields
}
FiscalYearTimeReportTableWriter is used for displaying reports in table format
func NewFiscalYearTimeReportTableWriter ¶
func NewFiscalYearTimeReportTableWriter(writer io.Writer) *FiscalYearTimeReportTableWriter
NewFiscalYearTimeReportTableWriter creates a new FiscalYearTimeReportTableWriter
func (*FiscalYearTimeReportTableWriter) Append ¶
func (t *FiscalYearTimeReportTableWriter) Append(r *FiscalYearTimeReport)
Append adds FiscalYearTimeReport data to the table and updates the total hours
func (*FiscalYearTimeReportTableWriter) Render ¶
func (t *FiscalYearTimeReportTableWriter) Render()
Render displays the report data in a table format
type MonthlyMemberTimeReport ¶
type MonthlyMemberTimeReport struct { UserID int CalendarMonth CalendarMonth Start dateutil.Date End dateutil.Date Reports []*model.MemberTimeReport }
MonthlyMemberTimeReport represents user's time report data for a given month
func MonthlyMemberTimeReports ¶
func MonthlyMemberTimeReports(reports []*model.MemberTimeReport) []*MonthlyMemberTimeReport
MonthlyMemberTimeReports converts MemberTimeReport to MonthlyMemberTimeReport grouped by the calendar months
func NewMonthlyMemberTimeReport ¶
func NewMonthlyMemberTimeReport(userID int, month CalendarMonth) *MonthlyMemberTimeReport
NewMonthlyMemberTimeReport creates a new monthly time report
func (*MonthlyMemberTimeReport) Actual ¶
func (tr *MonthlyMemberTimeReport) Actual() float64
Actual returns total actual hours
func (*MonthlyMemberTimeReport) Append ¶
func (tr *MonthlyMemberTimeReport) Append(r *model.MemberTimeReport)
Append time report data to the monthly report
func (*MonthlyMemberTimeReport) Planned ¶
func (tr *MonthlyMemberTimeReport) Planned() float64
Planned returns total planned hours
func (*MonthlyMemberTimeReport) RenderTable ¶
func (tr *MonthlyMemberTimeReport) RenderTable(writer io.Writer)
RenderTable renders monthly time report data in a table format
type MonthlyTimeReport ¶
type MonthlyTimeReport struct { CalendarMonth CalendarMonth Client *model.Client Project *model.Project Planned float64 Actual float64 }
MonthlyTimeReport represents time report data for a calendar month
func (*MonthlyTimeReport) BillableStatus ¶
func (r *MonthlyTimeReport) BillableStatus() string
BillableStatus returns project's billable status
type MonthlyTimeReportTableWriter ¶
type MonthlyTimeReportTableWriter struct {
// contains filtered or unexported fields
}
MonthlyTimeReportTableWriter is used for displaying monthly time report data in a table format
func NewMonthlyTimeReportTableWriter ¶
func NewMonthlyTimeReportTableWriter(writer io.Writer) *MonthlyTimeReportTableWriter
NewMonthlyTimeReportTableWriter creates a new MonthlyTimeReportTableWriter
func (*MonthlyTimeReportTableWriter) Append ¶
func (t *MonthlyTimeReportTableWriter) Append(r *MonthlyTimeReport)
Append adds time report data to the table and updates the report totals
func (*MonthlyTimeReportTableWriter) Render ¶
func (t *MonthlyTimeReportTableWriter) Render()
Render displays the time report data in a table format
type ProjectMemberTimeReport ¶
type ProjectMemberTimeReport struct { UserID int Client *model.Client Project *model.Project Start dateutil.Date End dateutil.Date Reports []*model.MemberTimeReport }
ProjectMemberTimeReport represents time report data for a given project and team member
func NewProjectMemberTimeReport ¶
func NewProjectMemberTimeReport(userID int, client *model.Client, project *model.Project) *ProjectMemberTimeReport
NewProjectMemberTimeReport creates a new ProjectMemberTimeReport for the given project and user
func ProjectMemberTimeReports ¶
func ProjectMemberTimeReports(reports []*model.MemberTimeReport) []*ProjectMemberTimeReport
ProjectMemberTimeReports converts MemberTimeReport to ProjectMemberTimeReport grouped by projects
func (*ProjectMemberTimeReport) Actual ¶
func (tr *ProjectMemberTimeReport) Actual() float64
Actual returns total actual hours
func (*ProjectMemberTimeReport) Append ¶
func (tr *ProjectMemberTimeReport) Append(r *model.MemberTimeReport)
Append adds time report data to the report
func (*ProjectMemberTimeReport) Planned ¶
func (tr *ProjectMemberTimeReport) Planned() float64
Planned returns total planned hours
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service provides methods for fetching time report data from Glass Factory
func NewService ¶
NewService creates a new Service for reporting
func (*Service) FiscalYearMemberTimeReports ¶
func (s *Service) FiscalYearMemberTimeReports(userID int, fiscalYear *FiscalYear) ([]*FiscalYearMemberTimeReport, error)
FiscalYearMemberTimeReports queries Glass Factory and returns time reports for the given fiscal year
func (*Service) MonthlyMemberTimeReports ¶
func (s *Service) MonthlyMemberTimeReports(userID int, t time.Time) ([]*MonthlyMemberTimeReport, error)
MonthlyMemberTimeReports queries Glass Factory and returns time reports for a full calendar year matching the given time
type TimeReportTotals ¶
type TimeReportTotals struct {
// contains filtered or unexported fields
}
TimeReportTotals represents the total actual and planned hours