Compare commits

...

No commits in common. "e6ef66194e9c2b95bde41b23d06788e95b1a06dd" and "0a00ee8323c27cda5a92f80907c80acde8ef507b" have entirely different histories.

2 changed files with 6 additions and 5 deletions

4
api.go
View File

@ -95,12 +95,12 @@ func (s *HTTPServer) RegisterAPIRoutes(r *mux.Router) {
} }
// Get current time and default conversation. // Get current time and default conversation.
now := time.Now().UTC() now := time.Now()
conversation := app.config.Slack.AdminID conversation := app.config.Slack.AdminID
// Find plan times that are occuring right now. // Find plan times that are occuring right now.
var planTime PlanTimes var planTime PlanTimes
app.db.Where("time_type='service' AND starts_at < ? AND ends_at > ?", now, now).First(&planTime) app.db.Where("time_type='service' AND starts_at < ? AND ends_at < ?", now, now).First(&planTime)
if planTime.Plan != 0 { if planTime.Plan != 0 {
// If plan found, check for the slack channel. // If plan found, check for the slack channel.
var channel SlackChannels var channel SlackChannels

View File

@ -184,7 +184,7 @@ func UpdatePCData() {
p.UpdatedAt = attributes.GetDate("updated_at") p.UpdatedAt = attributes.GetDate("updated_at")
p.Status = attributes.GetString("status") p.Status = attributes.GetString("status")
p.TeamPositionName = attributes.GetString("team_position_name") p.TeamPositionName = attributes.GetString("team_position_name")
// If person wasn't existing, create them. // If person wasn't existing, create them.
if p.ID == 0 { if p.ID == 0 {
p.ID = id p.ID = id
@ -265,7 +265,7 @@ func UpdateSlackData() {
sort.Slice(people, func(i, j int) bool { sort.Slice(people, func(i, j int) bool {
return people[i].Distance < people[j].Distance return people[i].Distance < people[j].Distance
}) })
// Debug output for comparing scores. // Debug output for comparing scores.
// for _, person := range people { // for _, person := range people {
// fmt.Printf("%d %s (%s) %s\n", person.Distance, u.Name, u.RealName, person.FirstName+" "+person.LastName) // fmt.Printf("%d %s (%s) %s\n", person.Distance, u.Name, u.RealName, person.FirstName+" "+person.LastName)
@ -297,7 +297,7 @@ func CreateSlackChannels() {
// setting a day of the week for slack channels to be created on. // setting a day of the week for slack channels to be created on.
// Doing a day of the week will allow for channels to be created ahead of time, then // Doing a day of the week will allow for channels to be created ahead of time, then
// if people are added to the plan later on, they can be added at the next cron run. // if people are added to the plan later on, they can be added at the next cron run.
startDate := time.Now().UTC() startDate := time.Now()
// Last date is start date plus duration of create channels ahead. // Last date is start date plus duration of create channels ahead.
lastDate := startDate.Add(app.config.Slack.CreateChannelsAhead) lastDate := startDate.Add(app.config.Slack.CreateChannelsAhead)
@ -411,6 +411,7 @@ func CreateSlackChannels() {
app.db.Create(&channel) app.db.Create(&channel)
} }
// Get the previous users that were invited to the channel. // Get the previous users that were invited to the channel.
invited := strings.Split(channel.UsersInvited, ",") invited := strings.Split(channel.UsersInvited, ",")
// If nothing is previous, reset the slice to nil. // If nothing is previous, reset the slice to nil.