about summary refs log tree commit diff
path: root/src/docker.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/docker.go')
-rw-r--r--src/docker.go18
1 files changed, 7 insertions, 11 deletions
diff --git a/src/docker.go b/src/docker.go
index 236580f..79cf67d 100644
--- a/src/docker.go
+++ b/src/docker.go
@@ -23,7 +23,7 @@ var (
 	dockerCLI *client.Client
 
 	// store the amount of flags each user has found
-	userFlags map[string]int
+	userScore map[string]int
 	users     []string // list of users
 )
 
@@ -34,7 +34,8 @@ type Statistics struct {
 		FoundFlag int64  `json:"foundFlag"`
 		FlagTries uint   `json:"flagTries"`
 	} `json:"challenges"`
-	User string `json:"user"`
+	User  string `json:"user"`
+	Score int    `json:"score"`
 }
 
 func setupContext() {
@@ -135,17 +136,12 @@ func listDockerContainers() {
 				users = append(users, statsGoStruct.User)
 			}
 
-			if userFlags == nil {
-				userFlags = make(map[string]int)
+			if userScore == nil {
+				userScore = make(map[string]int)
 			}
 
-			// count the amount of flags each user has found
-			userFlags[statsGoStruct.User] = 0
-			for _, chall := range statsGoStruct.Challenges {
-				if chall.FoundFlag > 1 {
-					userFlags[statsGoStruct.User]++
-				}
-			}
+			// update the score if the individual user
+			userScore[statsGoStruct.User] = statsGoStruct.Score
 		}
 	}
 }