Fix device Update History for PostrgreSQL
The column names are lowercase and the grouping seems to work
different compared to sqlite.
diff --git a/crashreport_stats/raw_querys.py b/crashreport_stats/raw_querys.py
index f6ee8b8..ad08a26 100644
--- a/crashreport_stats/raw_querys.py
+++ b/crashreport_stats/raw_querys.py
@@ -39,7 +39,7 @@
( select count(crashreports_crashreport.id) from crashreports_crashreport
where boot_reason in ("RTC alarm")
and crashreports_device.id == crashreports_crashreport.device_id
- and crashreports_crashreport.build_fingerprint == crashreports_heartbeat.build_fingerprint ) as SMPL,
+ and crashreports_crashreport.build_fingerprint == crashreports_heartbeat.build_fingerprint ) as smpl,
( select count(crashreports_crashreport.id) from crashreports_crashreport
where boot_reason not in ("UNKNOWN", "keyboard power on", "RTC alarm")
and crashreports_device.id == crashreports_crashreport.device_id
@@ -65,18 +65,18 @@
SELECT
min(crashreports_heartbeat.date) as update_date,
build_fingerprint,
- max(device_id),
+ max(crashreports_device.id),
( select count(crashreports_crashreport.id) from crashreports_crashreport
where boot_reason in ('UNKNOWN', 'keyboard power on')
- and device_id = crashreports_crashreport.device_id
+ and max(crashreports_device.id) = crashreports_crashreport.device_id
and crashreports_crashreport.build_fingerprint = crashreports_heartbeat.build_fingerprint ) as prob_crashes,
( select count(crashreports_crashreport.id) from crashreports_crashreport
where boot_reason in ('RTC alarm')
- and device_id = crashreports_crashreport.device_id
- and crashreports_crashreport.build_fingerprint = crashreports_heartbeat.build_fingerprint ) as SMPL,
+ and max(crashreports_device.id) = crashreports_crashreport.device_id
+ and crashreports_crashreport.build_fingerprint = crashreports_heartbeat.build_fingerprint ) as smpl,
( select count(crashreports_crashreport.id) from crashreports_crashreport
where boot_reason not in ('UNKNOWN', 'keyboard power on', 'RTC alarm')
- and device_id = crashreports_crashreport.device_id
+ and max(crashreports_device.id) = crashreports_crashreport.device_id
and crashreports_crashreport.build_fingerprint = crashreports_heartbeat.build_fingerprint ) as other,
count(crashreports_heartbeat.id) as heartbeats
FROM
diff --git a/crashreport_stats/templates/crashreport_stats/tags/device_update_history.html b/crashreport_stats/templates/crashreport_stats/tags/device_update_history.html
index efddfaf..4bce158 100644
--- a/crashreport_stats/templates/crashreport_stats/tags/device_update_history.html
+++ b/crashreport_stats/templates/crashreport_stats/tags/device_update_history.html
@@ -15,7 +15,7 @@
new Date(obj.update_date),
obj.heartbeats,
(obj.prob_crashes/(obj.heartbeats * 1.0)),
- (obj.SMPL/(obj.heartbeats * 1.0)),
+ (obj.smpl/(obj.heartbeats * 1.0)),
];
return ret;
});