Skip to content

Instantly share code, notes, and snippets.

@kylebrandt
Created October 7, 2014 16:43
Show Gist options
  • Save kylebrandt/89dc754c658340e87d97 to your computer and use it in GitHub Desktop.
Save kylebrandt/89dc754c658340e87d97 to your computer and use it in GitHub Desktop.
package main
import (
"fmt"
"time"
)
type Meeting struct {
Who []Person
When time.Time
Location string
Duration time.Duration
Objectives []Objective
}
type Objective struct {
Goal string
Notes string
ObjectiveResult
}
type ObjectiveResult struct {
Decision string
Reason string
Actions []Action
}
type Action struct {
Task string
Who Person
By time.Time
}
type Person struct {
Name string
Email string
Why string
}
func (m *Meeting) CanStart() (bool, string) {
var reasons []string
if len(m.Objectives) == 0 {
reasons = append(reasons, "No Objectives? WTF Dude?")
}
for _, o := range m.Objectives {
if o.Goal == "" {
reasons = append(reasons, "An Objective with no goal? Don't waste my time.")
}
}
if m.Location == "" {
reasons = append(reasons, "No place to meet? You have fun I'll be in the bar.")
}
if len(m.Who) == 0 {
reasons = append(reasons, "No people? Well okay, you go and have that 'meeting'.")
}
if &m.Duration == nil || m.Duration.Hours() > 1 {
reasons = append(reasons, "Your meeting has no end or is longer than an hour? I hate you.")
}
if len(m.Who) > 8 {
reasons = append(reasons, "Really? More than 8 people in this meeting? I'll help with that by not showing up.")
}
for _, w := range m.Who {
if w.Name == "" || w.Email == "" {
reasons = append(reasons, "Incomplete Contact info. You lazy ass.")
}
if w.Why == "" {
reasons = append(reasons, "You don't know why you invited %v? You expect me to share my air with that person for no reason?", w.Name)
}
}
if len(reasons) != 0 {
return false, fmt.Sprintf("No Meeting For You: %v\n", reasons)
}
return true, "You are a meeting ninja, you may proceed"
}
func (m *Meeting) Success() (bool, string) {
var reasons []string
if start, _ := m.CanStart(); !start {
reasons = append(reasons, "This meeting shouldn't have even started...cheater")
}
for _, objective := range m.Objectives {
if objective.Decision == "" {
reasons = append(reasons, "No decision reached for %v. Way to waste everyones time asshat")
}
if objective.Reason == "" {
reasons = append(reasons, "If you don't record why you made this decision, I promise everyone will tell you why it was wrong down the road once we have hindsight. And we will enjoy doing so.")
}
if len(objective.Actions) == 0 {
reasons = append(reasons, "So we just spend all this time talking, and nobody is going to do anything. You owe each of us a Pint.")
}
for _, action := range objective.Actions {
if action.Task == "" {
reasons = append(reasons, "No Task? Guess you just like to get people together to listen to you pontificate you righteous jackass")
}
if &action.Who == nil {
reasons = append(reasons, "Tasks that don't get assigned likely won't get done numbnuts.")
}
}
}
if len(reasons) == 0 {
return true, "You, my friend, get a gold badge in meetings"
}
return false, fmt.Sprintf("You + Meetings == FAIL: %v\n", reasons)
}
func main() {
var m Meeting
cs, sr := m.CanStart()
fmt.Println(cs, sr)
s, r := m.Success()
fmt.Println(s, r)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment