Skip to content

Commit

Permalink
Don't check for all users, it makes location slow
Browse files Browse the repository at this point in the history
  • Loading branch information
schollz committed Jan 13, 2017
1 parent 769aacd commit f917250
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions api.go
Original file line number Diff line number Diff line change
Expand Up @@ -390,18 +390,14 @@ func getUserLocations(c *gin.Context) {
return
}
people := make(map[string][]UserPositionJSON)
allusers := getUsers(group)
if userQuery != "noneasdf" {
usersQuery = userQuery
}
users := strings.Split(strings.ToLower(usersQuery), ",")
if users[0] == "noneasdf" {
users = allusers
users = []string{userQuery}
}
if users[0] == "noneasdf" {
users = getUsers(group)
}
for _, user := range users {
if !stringInSlice(user, allusers) {
continue
}
if _, ok := people[user]; !ok {
people[user] = []UserPositionJSON{}
}
Expand All @@ -418,7 +414,6 @@ func getUserLocations(c *gin.Context) {
message = "No users found for username " + strings.Join(users, " or ")
people = nil
}

c.JSON(http.StatusOK, gin.H{"message": message, "success": true, "users": people})
} else {
c.JSON(http.StatusOK, gin.H{"success": false, "message": "Error parsing request"})
Expand Down

0 comments on commit f917250

Please sign in to comment.