about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authormaride <maride@darknebu.la>2018-08-22 11:18:37 +0200
committermaride <maride@darknebu.la>2018-08-22 11:18:37 +0200
commit71f083bebcb76d28ced994f24a2babd79dd84bb5 (patch)
tree3c0569092367f08a90ccab63acdda87770542795 /src
parent1e15776d63fc685549e694b5e99529100e96c9ba (diff)
Add filter for challenge categories
Diffstat (limited to 'src')
-rw-r--r--src/seed.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/seed.go b/src/seed.go
index fde4265..5dc849c 100644
--- a/src/seed.go
+++ b/src/seed.go
@@ -78,13 +78,18 @@ func getChallengesFromSeedFile() {
 func generateJSONFromChallenges() (string, error) {
 	// To avoid leakage of container name or the flag towards the user, we need to strip the challenges
 	var strippedChallenges []StrippedChallenge
+	categories := map[string]int{}
 
 	for _, challenge := range challenges {
+		// Append challenge to list
 		strippedChallenges = append(strippedChallenges, stripChallenge(challenge))
+
+		categories[challenge.Category]++
 	}
 
-	marshalled, marshalError := json.Marshal(map[string][]StrippedChallenge{
+	marshalled, marshalError := json.Marshal(map[string]interface{}{
 		"challenges": strippedChallenges,
+		"categories": categories,
 	})
 	return string(marshalled), marshalError
 }