Almost there
This commit is contained in:
12
server.go
12
server.go
@@ -111,14 +111,14 @@ func getSnapshotFromPythonScript() (*SnapshotSubmission, error) {
|
||||
)
|
||||
}
|
||||
tokens := strings.Split(string(output), "\n")
|
||||
if len(tokens) != 4 {
|
||||
if len(tokens) != 5 {
|
||||
return nil, errors.New(fmt.Sprintf("Strange python output: %s", output))
|
||||
}
|
||||
snapshot := SnapshotSubmission{
|
||||
Timestamp: tokens[0],
|
||||
Temp: tokens[1],
|
||||
Humidity: tokens[2],
|
||||
Co2: tokens[3],
|
||||
Timestamp: strings.Split(tokens[0], "\t")[1],
|
||||
Temp: strings.Split(tokens[1], "\t")[1],
|
||||
Humidity: strings.Split(tokens[2], "\t")[1],
|
||||
Co2: strings.Split(tokens[3], "\t")[1],
|
||||
}
|
||||
return &snapshot, nil
|
||||
}
|
||||
@@ -142,4 +142,4 @@ func internalErrorOnErr(err error, w http.ResponseWriter, r *http.Request) bool
|
||||
func logError(errorMessage string) {
|
||||
fmt.Println(errorMessage)
|
||||
mainLogger.Println(errorMessage)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user