Skip to content

Commit

Permalink
No more pgn in db, tweak graph size
Browse files Browse the repository at this point in the history
  • Loading branch information
glinscott committed Apr 29, 2018
1 parent 2d6704e commit ec09178
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
12 changes: 11 additions & 1 deletion go/src/server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"errors"
"fmt"
"io"
"io/ioutil"
"log"
"math"
"mime/multipart"
Expand Down Expand Up @@ -321,7 +322,6 @@ func uploadGame(c *gin.Context) {
TrainingRunID: training_run.ID,
NetworkID: network.ID,
Version: uint(version),
Pgn: c.PostForm("pgn"),
EngineVersion: c.PostForm("engineVersion"),
}
err = db.GetDB().Create(&game).Error
Expand All @@ -347,6 +347,16 @@ func uploadGame(c *gin.Context) {
return
}

// Save pgn
pgn_path := fmt.Sprintf("pgns/run%d/%d.pgn", training_run.ID, game.ID)
os.MkdirAll(filepath.Dir(pgn_path), os.ModePerm)
err = ioutil.WriteFile(pgn_path, []byte(c.PostForm("pgn")), 0644)
if err != nil {
log.Println(err.Error())
c.String(500, "Saving pgn")
return
}

c.String(http.StatusOK, fmt.Sprintf("File %s uploaded successfully with fields user=%s.", file.Filename, user.Username))
}

Expand Down
4 changes: 2 additions & 2 deletions go/src/server/templates/index.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<a href="https://en.chessbase.com/post/leela-chess-zero-alphazero-for-the-pc">Chessbase article</a> on LCZero! Download latest client <a href="https://github.com/glinscott/leela-chess/releases/tag/v0.7">here</a>.
</div>
<div class="alert alert-primary" role="alert">
We are raising funds to upgrade the training hardware, and train bigger networks: <a href="https://www.gofundme.com/leela-chess-zero">https://www.gofundme.com/leela-chess-zero</a>.
Thanks so much for everyone who contributed to the <a href="https://www.gofundme.com/leela-chess-zero">GoFundMe</a> for the training hardware!
</div>

<div class="d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pb-2 mb-3 border-bottom">
Expand Down Expand Up @@ -63,7 +63,7 @@ var vlSpec = {
"$schema": "https://vega.github.io/schema/vega-lite/v2.0.json",
"description": "Leela Chess Elo rating",
"config": {
"point": { "size": 80 }
"point": { "size": 50 }
},
"width": 563, "height": 375,
"data": {"values": {{.progress}}},
Expand Down

0 comments on commit ec09178

Please sign in to comment.