diff --git a/models/compat/wakatime/v1/heartbeat.go b/models/compat/wakatime/v1/heartbeat.go index 1e409d1c..2aeb9169 100644 --- a/models/compat/wakatime/v1/heartbeat.go +++ b/models/compat/wakatime/v1/heartbeat.go @@ -30,7 +30,7 @@ type HeartbeatEntry struct { Lines uint32 `json:"lines"` LineNumber uint32 `json:"lineno,omitempty"` CursorPosition uint32 `json:"cursorpos,omitempty"` - Dependencies string `json:"dependencies,omitempty"` + Dependencies []string `json:"dependencies,omitempty"` Time float64 `json:"time"` Type string `json:"type"` UserId string `json:"user_id"` diff --git a/models/heartbeat.go b/models/heartbeat.go index 77d94ca4..58fae2d7 100644 --- a/models/heartbeat.go +++ b/models/heartbeat.go @@ -27,7 +27,7 @@ type Heartbeat struct { CursorPosition uint32 `json:"cursorpos,omitempty"` Branch string `json:"branch" gorm:"index:idx_branch"` Language string `json:"language" gorm:"index:idx_language"` - Dependencies string `json:"dependencies,omitempty" gorm:"type:text"` + Dependencies []string `json:"dependencies,omitempty" gorm:"serializer:json;type:text"` IsWrite bool `json:"is_write,omitempty"` Editor string `json:"editor" gorm:"index:idx_editor" hash:"ignore"` // ignored because editor might be parsed differently by wakatime OperatingSystem string `json:"operating_system" gorm:"index:idx_operating_system" hash:"ignore"` // ignored because os might be parsed differently by wakatime diff --git a/routes/utils/heartbeat_utils.go b/routes/utils/heartbeat_utils.go index 429b1b23..6a2a43f0 100644 --- a/routes/utils/heartbeat_utils.go +++ b/routes/utils/heartbeat_utils.go @@ -20,6 +20,8 @@ func ParseHeartbeats(r *http.Request) ([]*models.Heartbeat, error) { r.Body.Close() r.Body = io.NopCloser(bytes.NewBuffer(body)) + fmt.Println(string(body)) + conf.Log().Debug("Parsing heartbeat array") // Try bulk first