diff options
| author | Arda Serdar Pektezol <1669855+pektezol@users.noreply.github.com> | 2023-07-03 19:56:09 +0300 |
|---|---|---|
| committer | Arda Serdar Pektezol <1669855+pektezol@users.noreply.github.com> | 2023-07-03 19:56:09 +0300 |
| commit | db9482a73804e3461389553ba26a40f488c51180 (patch) | |
| tree | 031973fde8426ed7c5ac07b09029de60dc0c5c60 /backend/controllers/recordController.go | |
| parent | docs: add missing field to post record (diff) | |
| download | lphub-db9482a73804e3461389553ba26a40f488c51180.tar.gz lphub-db9482a73804e3461389553ba26a40f488c51180.tar.bz2 lphub-db9482a73804e3461389553ba26a40f488c51180.zip | |
fix: change demo save location
Former-commit-id: 2e7592b91f3787b501c798397838ba858f4103f7
Diffstat (limited to 'backend/controllers/recordController.go')
| -rw-r--r-- | backend/controllers/recordController.go | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/backend/controllers/recordController.go b/backend/controllers/recordController.go index 6751afc..891dfef 100644 --- a/backend/controllers/recordController.go +++ b/backend/controllers/recordController.go | |||
| @@ -91,12 +91,12 @@ func CreateRecordWithDemo(c *gin.Context) { | |||
| 91 | for i, header := range demoFiles { | 91 | for i, header := range demoFiles { |
| 92 | uuid := uuid.New().String() | 92 | uuid := uuid.New().String() |
| 93 | // Upload & insert into demos | 93 | // Upload & insert into demos |
| 94 | err = c.SaveUploadedFile(header, "parser/demos/"+header.Filename) | 94 | err = c.SaveUploadedFile(header, "parser/"+header.Filename) |
| 95 | if err != nil { | 95 | if err != nil { |
| 96 | c.JSON(http.StatusBadRequest, models.ErrorResponse(err.Error())) | 96 | c.JSON(http.StatusBadRequest, models.ErrorResponse(err.Error())) |
| 97 | return | 97 | return |
| 98 | } | 98 | } |
| 99 | f, err := os.Open("parser/demos/" + header.Filename) | 99 | f, err := os.Open("parser/" + header.Filename) |
| 100 | if err != nil { | 100 | if err != nil { |
| 101 | c.JSON(http.StatusBadRequest, models.ErrorResponse(err.Error())) | 101 | c.JSON(http.StatusBadRequest, models.ErrorResponse(err.Error())) |
| 102 | return | 102 | return |
| @@ -107,7 +107,7 @@ func CreateRecordWithDemo(c *gin.Context) { | |||
| 107 | c.JSON(http.StatusBadRequest, models.ErrorResponse(err.Error())) | 107 | c.JSON(http.StatusBadRequest, models.ErrorResponse(err.Error())) |
| 108 | return | 108 | return |
| 109 | } | 109 | } |
| 110 | hostDemoScoreCount, hostDemoScoreTime, err = parser.ProcessDemo("parser/demos/" + header.Filename) | 110 | hostDemoScoreCount, hostDemoScoreTime, err = parser.ProcessDemo("parser/" + header.Filename) |
| 111 | if err != nil { | 111 | if err != nil { |
| 112 | c.JSON(http.StatusBadRequest, models.ErrorResponse(err.Error())) | 112 | c.JSON(http.StatusBadRequest, models.ErrorResponse(err.Error())) |
| 113 | return | 113 | return |
| @@ -125,7 +125,7 @@ func CreateRecordWithDemo(c *gin.Context) { | |||
| 125 | c.JSON(http.StatusBadRequest, models.ErrorResponse(err.Error())) | 125 | c.JSON(http.StatusBadRequest, models.ErrorResponse(err.Error())) |
| 126 | return | 126 | return |
| 127 | } | 127 | } |
| 128 | os.Remove("parser/demos/" + header.Filename) | 128 | os.Remove("parser/" + header.Filename) |
| 129 | } | 129 | } |
| 130 | // Insert into records | 130 | // Insert into records |
| 131 | if isCoop { | 131 | if isCoop { |