The new logbot, not committed from the wrong terminal window this time.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

31 lines
675 B

package models
import "time"
// A Log represents a log session.
type Log struct {
ID string `json:"id"`
Date time.Time `json:"date"`
ChannelName string `json:"channelName"`
Title string `json:"title"`
EventName string `json:"eventName"`
Description string `json:"description"`
Open bool `json:"open"`
Posts []Post `json:"posts"`
}
// LatestTime gets the latest timestamp in the log.
func (log *Log) LatestTime() time.Time {
if len(log.Posts) == 0 {
return log.Date
}
latest := log.Date
for _, post := range log.Posts {
if post.Time.After(latest) {
latest = post.Time
}
}
return latest
}