-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
297 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package main | ||
|
||
// Returns a string with the name of people who still need to answer, excluding people from the second slice | ||
func formatUsers(groupIDs []string, answeredIDs []string) string { | ||
var s string | ||
for _, d := range groupIDs { | ||
if !contains(answeredIDs, d) { | ||
s += getNickname(d) + ", " | ||
} | ||
} | ||
|
||
// Deletes the last comma | ||
return s[:len(s)-2] | ||
} | ||
|
||
// Returns true if the slice contains the element d | ||
func contains(slice []string, d string) bool { | ||
for _, u := range slice { | ||
if u == d { | ||
return true | ||
} | ||
} | ||
|
||
return false | ||
} | ||
|
||
// Returns the original slice minus the element str | ||
func removeString(slice []string, str string) []string { | ||
for i, v := range slice { | ||
if v == str { | ||
return append(slice[:i], slice[i+1:]...) | ||
} | ||
} | ||
|
||
return slice | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters