From f9decd15e8b94374a20f4ff381f2c6763cbe0b97 Mon Sep 17 00:00:00 2001 From: Lesterpig Date: Mon, 28 Nov 2016 13:53:57 +0100 Subject: [PATCH] Fix SQL aggregation --- lib/persistence/terminated_job.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/persistence/terminated_job.go b/lib/persistence/terminated_job.go index 088c949..8c40fe7 100644 --- a/lib/persistence/terminated_job.go +++ b/lib/persistence/terminated_job.go @@ -75,7 +75,7 @@ func GetLastNJobs(count int) ([]*TerminatedJob, error) { func GetValidatedChallengePerUser() (map[string][]*TerminatedJob, error) { res := make(map[string][]*TerminatedJob) - rows, err := DB.Query("SELECT uuid, challenge, username, status, datetime(MIN(created)) FROM job GROUP BY challenge, username HAVING status = 3") + rows, err := DB.Query("SELECT uuid, challenge, username, status, datetime(MIN(created)) FROM job WHERE status=3 GROUP BY challenge, username") if err != nil { return nil, err }