1
0
mirror of https://github.com/mgerb/mywebsite synced 2026-01-10 01:42:55 +00:00

minor fix

This commit is contained in:
2016-09-10 20:51:00 +00:00
parent e2cb0969d7
commit e558fe5da2

View File

@@ -149,21 +149,7 @@ func HandleSensorByLocationYear(w http.ResponseWriter, r *http.Request, ps httpr
s, err := daily_sensor.GetAllSensorInfoByYear(location, year)
var response string
if err != nil {
log.Println(err)
response = "{message : \"Error loading data from database\""
} else {
js, err := json.MarshalIndent(s, "", " ")
if err != nil {
log.Println(err)
response = "{message : \"Error loading data from database\""
} else {
response = string(js)
}
}
response := createResponse(s, err)
fmt.Fprint(w, response)
}
@@ -178,21 +164,7 @@ func HandleSensorByLocationMonth(w http.ResponseWriter, r *http.Request, ps http
s, err := daily_sensor.GetAllSensorInfoByMonth(location, year, monthname)
var response string
if err != nil {
log.Println(err)
response = "{message : \"Error loading data from database\""
} else {
js, err := json.MarshalIndent(s, "", " ")
if err != nil {
log.Println(err)
response = "{message : \"Error loading data from database\""
} else {
response = string(js)
}
}
response := createResponse(s, err)
fmt.Fprint(w, response)
}