fix(analyticsApi): fixed last_30_days_data (6)
Build and Push Docker image / build-and-push (push) Successful in 2m12s Details

This commit is contained in:
Valentin Kolb 2024-11-13 02:22:56 +01:00
parent b0b92f0e64
commit 6aa51ea129
1 changed files with 2 additions and 1 deletions

View File

@ -124,7 +124,7 @@ func initPageViewCount(app *pocketbase.PocketBase, e *core.ServeEvent) {
Last30DaysData []Last30DaysData `json:"last_30_days_data"` Last30DaysData []Last30DaysData `json:"last_30_days_data"`
} }
// Query paginated items, sorted by count // Query paginated items, retrieving last_30_days_data as a JSON string
var rawItems []struct { var rawItems []struct {
ID int `json:"id"` ID int `json:"id"`
Path string `json:"path"` Path string `json:"path"`
@ -183,6 +183,7 @@ func initPageViewCount(app *pocketbase.PocketBase, e *core.ServeEvent) {
var items []Item var items []Item
for _, rawItem := range rawItems { for _, rawItem := range rawItems {
var last30DaysData []Last30DaysData var last30DaysData []Last30DaysData
logger.LogInfoF("rawItem.Last30DaysData: %v", rawItem.Last30DaysData)
if rawItem.Last30DaysData != "" { if rawItem.Last30DaysData != "" {
if err := json.Unmarshal([]byte(rawItem.Last30DaysData), &last30DaysData); err != nil { if err := json.Unmarshal([]byte(rawItem.Last30DaysData), &last30DaysData); err != nil {
return apis.NewApiError(500, "Failed to parse last_30_days_data", err) return apis.NewApiError(500, "Failed to parse last_30_days_data", err)