From 71f083bebcb76d28ced994f24a2babd79dd84bb5 Mon Sep 17 00:00:00 2001 From: maride Date: Wed, 22 Aug 2018 11:18:37 +0200 Subject: Add filter for challenge categories --- src/seed.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/seed.go') 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 } -- cgit 1.4.1