fix: Correct database table and column names in analytics queries
Some checks failed
ParentFlow CI/CD Pipeline / Backend Tests (push) Has been cancelled
ParentFlow CI/CD Pipeline / Frontend Tests (push) Has been cancelled
ParentFlow CI/CD Pipeline / Security Scanning (push) Has been cancelled
ParentFlow CI/CD Pipeline / Build Docker Images (map[context:maternal-app/maternal-app-backend dockerfile:Dockerfile.production name:backend]) (push) Has been cancelled
ParentFlow CI/CD Pipeline / Build Docker Images (map[context:maternal-web dockerfile:Dockerfile.production name:frontend]) (push) Has been cancelled
ParentFlow CI/CD Pipeline / Deploy to Development (push) Has been cancelled
ParentFlow CI/CD Pipeline / Deploy to Production (push) Has been cancelled
CI/CD Pipeline / Lint and Test (push) Has been cancelled
CI/CD Pipeline / E2E Tests (push) Has been cancelled
CI/CD Pipeline / Build Application (push) Has been cancelled
Some checks failed
ParentFlow CI/CD Pipeline / Backend Tests (push) Has been cancelled
ParentFlow CI/CD Pipeline / Frontend Tests (push) Has been cancelled
ParentFlow CI/CD Pipeline / Security Scanning (push) Has been cancelled
ParentFlow CI/CD Pipeline / Build Docker Images (map[context:maternal-app/maternal-app-backend dockerfile:Dockerfile.production name:backend]) (push) Has been cancelled
ParentFlow CI/CD Pipeline / Build Docker Images (map[context:maternal-web dockerfile:Dockerfile.production name:frontend]) (push) Has been cancelled
ParentFlow CI/CD Pipeline / Deploy to Development (push) Has been cancelled
ParentFlow CI/CD Pipeline / Deploy to Production (push) Has been cancelled
CI/CD Pipeline / Lint and Test (push) Has been cancelled
CI/CD Pipeline / E2E Tests (push) Has been cancelled
CI/CD Pipeline / Build Application (push) Has been cancelled
- Changed 'devices' to 'device_registry' in getDeviceDistribution - Changed 'date_of_birth' to 'birth_date' in getAgeDistribution - Added deleted_at filter to exclude deleted children - Added proper ordering to age distribution results 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -111,7 +111,7 @@ export class DashboardService {
|
||||
ELSE 'Web'
|
||||
END as name,
|
||||
COUNT(*) * 100.0 / SUM(COUNT(*)) OVER () as value
|
||||
FROM devices
|
||||
FROM device_registry
|
||||
GROUP BY platform`,
|
||||
);
|
||||
|
||||
@@ -163,12 +163,21 @@ export class DashboardService {
|
||||
END as age,
|
||||
COUNT(*) as count
|
||||
FROM (
|
||||
SELECT EXTRACT(YEAR FROM AGE(date_of_birth)) * 12 + EXTRACT(MONTH FROM AGE(date_of_birth)) as age_months
|
||||
SELECT EXTRACT(YEAR FROM AGE(birth_date)) * 12 + EXTRACT(MONTH FROM AGE(birth_date)) as age_months
|
||||
FROM children
|
||||
WHERE date_of_birth IS NOT NULL
|
||||
WHERE birth_date IS NOT NULL AND deleted_at IS NULL
|
||||
) ages
|
||||
GROUP BY age
|
||||
ORDER BY age`,
|
||||
ORDER BY
|
||||
CASE age
|
||||
WHEN '0-6 months' THEN 1
|
||||
WHEN '6-12 months' THEN 2
|
||||
WHEN '1-2 years' THEN 3
|
||||
WHEN '2-3 years' THEN 4
|
||||
WHEN '3-4 years' THEN 5
|
||||
WHEN '4-5 years' THEN 6
|
||||
ELSE 7
|
||||
END`,
|
||||
);
|
||||
|
||||
return result.map((row: any) => ({
|
||||
|
||||
Reference in New Issue
Block a user