participant

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EmailInstructions

func EmailInstructions(pairs []*Pair, tmpl *template.Template, subject, emailTestRecipient string, sender email.Sender) error

EmailInstructions emails the instructions to the participants based on provided email template

func GenerateParticipantsJSON

func GenerateParticipantsJSON(participants []*Participant) (string, error)

GenerateParticipantsJSON generates readable JSON for the participants

func UpdateParticipantsJSON

func UpdateParticipantsJSON(participantsFilepath string, pairs []*Pair) error

UpdateParticipantsJSON takes

func WriteInstructions

func WriteInstructions(pairs []*Pair, tmpl *template.Template, extension string) error

WriteInstructions write the instructions for the participants to local files based on provided template

Types

type Instructions

type Instructions struct {
	GiverName         string
	ReceiverName      string
	ReceiverResponses []*Response
	ReceiverPlatforms []string
}

Instructions contains the information necessary for generating exchange instructions Works with the instructions MD template

type Pair

type Pair struct {
	Giver    *Participant
	Receiver *Participant
}

Pair is a pair of participants

func (*Pair) Score

func (p *Pair) Score() float64

Score provides a score for the pair based on previous pairings

type Participant

type Participant struct {
	EmailAddress     string // must be unique
	Skip             bool
	LatestRecipients []string
	Platforms        []string
	Responses        []*Response
}

Participant represents a person who will give/receive in the exchange

func GetParticipantsFromCSV

func GetParticipantsFromCSV(csvStr string, emailAddressColumn, platformsColumn int, ignoreColumns []int, platformsSeparator string) ([]*Participant, error)

GetParticipantsFromCSV transforms the CSV to a slice of Particpant

func GetParticipantsFromJSON

func GetParticipantsFromJSON(jsonStr string, skip bool) ([]*Participant, error)

GetParticipantsFromJSON transforms the json to a slice of Particpant

func MergeParticipants

func MergeParticipants(participants, previousParticipants []*Participant) []*Participant

MergeParticipants takes a set of participants and merges in previous participant data Previous participants who also exist in the participants slice have their pairing history included. Previous participants who don't exist in the participants slice are copied in with the pairing history and marked to be skipped.

func (*Participant) IsCompatible

func (p *Participant) IsCompatible(otherParticipant *Participant) bool

IsCompatible returns true if the participants have at least one music platform in common

type Response

type Response struct {
	Question string
	Answer   string
}

Response is a simple question/answer pair

Jump to

Keyboard shortcuts

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