Skip to content

Commit

Permalink
chooooo
Browse files Browse the repository at this point in the history
  • Loading branch information
Hiroaki KARASAWA committed Sep 8, 2019
1 parent 7606352 commit cca6ef5
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions webapp/go/main.go
Expand Up @@ -544,7 +544,7 @@ func initializeCategoryMap() error {
ID int `db:"id"`
}{}

err := dbx.Select(&ids, `SELECT id FROM categories`)
err := dbx.Select(&ids, "SELECT `id` FROM categories")

if err != nil {
return err
Expand All @@ -564,14 +564,7 @@ func initializeCategoryMap() error {
func postInitialize(w http.ResponseWriter, r *http.Request) {
defer measure.Start("postInitialize").Stop()

// err := initializeCategoryMap()

// if err != nil {
// log.Print(err)
// outputErrorMsg(w, http.StatusInternalServerError, "initialize category error")
// }

// ri := reqInitialize{}
ri := reqInitialize{}

err := json.NewDecoder(r.Body).Decode(&ri)
if err != nil {
Expand Down Expand Up @@ -616,6 +609,13 @@ func postInitialize(w http.ResponseWriter, r *http.Request) {
Language: "Go",
}

err = initializeCategoryMap()

if err != nil {
log.Print(err)
outputErrorMsg(w, http.StatusInternalServerError, "initialize category error")
}

w.Header().Set("Content-Type", "application/json;charset=utf-8")
json.NewEncoder(w).Encode(res)
}
Expand Down

0 comments on commit cca6ef5

Please sign in to comment.