report

package
v1.8.14 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2024 License: BSD-3-Clause Imports: 20 Imported by: 0

Documentation

Overview

Package report generates reports on the messages in a practice session.

Package report generates reports on the messages in a practice session.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Send

func Send(st Store, conn *jnos.Conn, session *store.Session)

Send generates the report for the session and sends it to all designated recipients, through the supplied open BBS connection and/or via SMTP. It also stores the report in the session.

Types

type Count

type Count struct {
	Name  string
	Count int
}

A Count contains a name/count pair.

type Message

type Message struct {
	ID           string
	Hash         string
	FromCallSign string
	Prefix       string
	Suffix       string
	Source       string
	Multiple     bool
	Jurisdiction string
	Score        int
	Summary      string
}

A Message contains the information about a single message in a Report.

type Report

type Report struct {
	SessionName       string
	SessionDate       string
	Preliminary       bool
	MessageTypes      []string
	HasModel          bool
	SentTo            string
	SentBefore        string
	SentAfter         string
	NotSentFrom       string
	Modified          bool
	ValidCount        int
	InvalidCount      int
	ReplacedCount     int
	DroppedCount      int
	AverageValidScore int

	UniqueCallSigns     int
	UniqueCallSignsWeek int
	Sources             []*Source
	Jurisdictions       []*Count
	MTypeCounts         []*Count
	Messages            []*Message
	Participants        []string
	GenerationInfo      string
	// contains filtered or unexported fields
}

A Report contains all of the information that goes into a report about a practice session. (This can include information from multiple sessions when a weekly summary is part of the report.)

func Generate

func Generate(st Store, session *store.Session) *Report

Generate generates the report for the specified session.

func (*Report) RenderEmail

func (r *Report) RenderEmail(to string) string

RenderEmail renders the receiver report in a form suitable for emailing. The email is a multipart/alternative email with plain text and HTML variants. The parameter is the To: line of the email.

func (*Report) RenderHTML

func (r *Report) RenderHTML(links string) string

RenderHTML renders a report in HTML format. If links is set to a call sign, only messages from that call sign have embedded links. If links is an empty string, all messages have embedded links.

func (*Report) RenderPlainText

func (r *Report) RenderPlainText() string

RenderPlainText renders a report in plain text format.

func (*Report) SendHTML

func (r *Report) SendHTML(to []string) error

SendHTML sends the report in HTML format to the specified address(es).

type Source

type Source struct {
	Name          string
	Count         int
	SimulatedDown bool
}

A Source contains the information about a single source of messages in a Report.

type Store

type Store interface {
	GetSessionMessages(int) []*store.Message
	GetSessions(start, end time.Time) []*store.Session
	UpdateSession(*store.Session)
	NextMessageID(string) string
}

Store is an interface covering those methods of store.Store that are used in generating reports.

Jump to

Keyboard shortcuts

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