feat(analyticsApi): added success_count to initAggregateCount
Build and Push Docker image / build-and-push (push) Successful in 2m13s
Details
Build and Push Docker image / build-and-push (push) Successful in 2m13s
Details
This commit is contained in:
parent
adc60e9960
commit
7b8316fbe3
|
@ -223,27 +223,27 @@ func initPageViewCount(app *pocketbase.PocketBase, e *core.ServeEvent) {
|
||||||
//
|
//
|
||||||
// {
|
// {
|
||||||
// "device_type": [
|
// "device_type": [
|
||||||
// { "value": "<device type>", "count": <session count>, "error_count": <error count> },
|
// { "value": "<device type>", "count": <session count>, "error_count": <error count>, "success_count": <success count> },
|
||||||
// ...
|
// ...
|
||||||
// ],
|
// ],
|
||||||
// "browser_name": [
|
// "browser_name": [
|
||||||
// { "value": "<browser name>", "count": <session count>, "error_count": <error count> },
|
// { "value": "<browser name>", "count": <session count>, "error_count": <error count>, "success_count": <success count> },
|
||||||
// ...
|
// ...
|
||||||
// ],
|
// ],
|
||||||
// "operating_system": [
|
// "operating_system": [
|
||||||
// { "value": "<operating system>", "count": <session count>, "error_count": <error count> },
|
// { "value": "<operating system>", "count": <session count>, "error_count": <error count>, "success_count": <success count> },
|
||||||
// ...
|
// ...
|
||||||
// ],
|
// ],
|
||||||
// "user_agent": [
|
// "user_agent": [
|
||||||
// { "value": "<user agent>", "count": <session count>, "error_count": <error count> },
|
// { "value": "<user agent>", "count": <session count>, "error_count": <error count>, "success_count": <success count> },
|
||||||
// ...
|
// ...
|
||||||
// ],
|
// ],
|
||||||
// "geo_country_code": [
|
// "geo_country_code": [
|
||||||
// { "value": "<country code>", "count": <session count>, "error_count": <error count> },
|
// { "value": "<country code>", "count": <session count>, "error_count": <error count>, "success_count": <success count> },
|
||||||
// ...
|
// ...
|
||||||
// ],
|
// ],
|
||||||
// "preferred_language": [
|
// "preferred_language": [
|
||||||
// { "value": "<preferred language>", "count": <session count>, "error_count": <error count> },
|
// { "value": "<preferred language>", "count": <session count>, "error_count": <error count>, "success_count": <success count> },
|
||||||
// ...
|
// ...
|
||||||
// ]
|
// ]
|
||||||
// }
|
// }
|
||||||
|
@ -266,9 +266,10 @@ func initAggregateCount(app *pocketbase.PocketBase, e *core.ServeEvent) {
|
||||||
}
|
}
|
||||||
|
|
||||||
type Data struct {
|
type Data struct {
|
||||||
Value string `db:"value" json:"value"`
|
Value string `db:"value" json:"value"`
|
||||||
Count int `db:"count" json:"count"`
|
Count int `db:"count" json:"count"`
|
||||||
ErrorCount int `db:"error_count" json:"error_count"`
|
SuccessCount int `db:"success_count" json:"success_count"`
|
||||||
|
ErrorCount int `db:"error_count" json:"error_count"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Use a map to store the response data
|
// Use a map to store the response data
|
||||||
|
@ -284,6 +285,7 @@ func initAggregateCount(app *pocketbase.PocketBase, e *core.ServeEvent) {
|
||||||
SELECT
|
SELECT
|
||||||
IFNULL(` + field + `, 'N/A') as value,
|
IFNULL(` + field + `, 'N/A') as value,
|
||||||
COUNT(id) AS count,
|
COUNT(id) AS count,
|
||||||
|
SUM(CASE WHEN error IS NULL THEN 1 ELSE 0 END) AS success_count,
|
||||||
SUM(CASE WHEN error IS NOT NULL THEN 1 ELSE 0 END) AS error_count
|
SUM(CASE WHEN error IS NOT NULL THEN 1 ELSE 0 END) AS error_count
|
||||||
FROM analyticsPageViewsWithSessionDetail
|
FROM analyticsPageViewsWithSessionDetail
|
||||||
WHERE created >= {:startDate}
|
WHERE created >= {:startDate}
|
||||||
|
|
Loading…
Reference in New Issue