stats

package
v1.4.3 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2023 License: MIT Imports: 19 Imported by: 0

Documentation

Overview

Package stats reports Focus session statistics

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Aggregates added in v1.4.0

type Aggregates struct {
	Weekly  map[string]time.Duration `json:"weekly"`
	Weekday map[string]time.Duration `json:"weekday"`
	Daily   map[string]time.Duration `json:"daily"`
	Yearly  map[string]time.Duration `json:"yearly"`
	Monthly map[string]time.Duration `json:"monthly"`
	Hourly  map[string]time.Duration `json:"hourly"`
	// contains filtered or unexported fields
}

type Opts added in v1.4.0

type Opts struct {
	config.FilterConfig
}

type Record added in v1.4.0

type Record struct {
	Name     string        `json:"name"`
	Duration time.Duration `json:"duration"`
}

type Stats added in v1.4.0

type Stats struct {
	Aggregates      Aggregates        `json:"aggregates"`
	StartTime       time.Time         `json:"start_time"`
	EndTime         time.Time         `json:"end_time"`
	DB              store.DB          `json:"-"`
	Opts            Opts              `json:"-"`
	Sessions        []*models.Session `json:"-"`
	LastDayTimeline []Timeline        `json:"timeline"`
	Summary         Summary           `json:"summary"`
}

Stats represents the computed focus statistics for a period of time.

func (*Stats) Compute added in v1.4.0

func (s *Stats) Compute(sessions []*models.Session)

Compute calculates Focus statistics for a specific time period.

func (*Stats) Server added in v1.4.0

func (s *Stats) Server(port uint) error

func (*Stats) ToJSON added in v1.4.0

func (s *Stats) ToJSON() ([]byte, error)

type Summary added in v1.4.0

type Summary struct {
	Tags         map[string]time.Duration `json:"-"`
	TotalTime    time.Duration            `json:"total_time"`
	Completed    int                      `json:"completed"`
	Abandoned    int                      `json:"abandoned"`
	AvgCompleted int                      `json:"avg_completed"`
	AvgAbandoned int                      `json:"avg_abandoned"`
	AvgTime      time.Duration            `json:"avg_time"`
}

type TemplateData added in v1.4.0

type TemplateData struct {
	StartTime string
	EndTime   string
	Stats     string
	MainChart string
	Days      int
}

type Timeline added in v1.4.0

type Timeline struct {
	StartTime time.Time     `json:"start_time"`
	Tags      []string      `json:"tags"`
	Duration  time.Duration `json:"duration"`
}

Jump to

Keyboard shortcuts

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