88 "fmt"
99 "net/http"
1010 "os"
11- "time"
1211)
1312
1413func CreateGP (res http.ResponseWriter , req * http.Request ) {
@@ -31,13 +30,13 @@ func CreateGP(res http.ResponseWriter, req *http.Request) {
3130 return
3231 }
3332
34- ea , err := modules .GPFromJSON (data )
33+ gp , err := modules .GPFromJSON (data )
3534 if err != nil {
3635 util .JSONResponse (res , http .StatusBadRequest , err .Error (), nil )
3736 return
3837 }
3938
40- code , err := ea .Code ()
39+ code , err := gp .Code ()
4140 if err != nil {
4241 util .JSONResponse (res , http .StatusBadRequest , err .Error (), nil )
4342 return
@@ -54,7 +53,7 @@ func CreateGP(res http.ResponseWriter, req *http.Request) {
5453 INSERT INTO run (name, description, type, command, createdBy)
5554 VALUES ($1, $2, $3, $4, $5)
5655 RETURNING id
57- ` , time . Now (). Local (). String ( ), "Genetic Programming (GP)" , "gp" , "python -m scoop code.py" , user ["id" ])
56+ ` , fmt . Sprintf ( "%d-%d" , gp . Generations , gp . PopulationSize ), "Genetic Programming (GP)" , "gp" , "python -m scoop code.py" , user ["id" ])
5857
5958 var runID string
6059 err = row .Scan (& runID )
@@ -126,5 +125,6 @@ func CreateGP(res http.ResponseWriter, req *http.Request) {
126125 return
127126 }
128127
128+ data ["runID" ] = runID
129129 util .JSONResponse (res , http .StatusOK , "It works! 👍🏻" , data )
130130}
0 commit comments