Goal: Track chvs who have upgraded to the latest cht-android (v1.0.4-4)
Method: Using the query below, I was expecting to track the chvs using the metadata → android_version_name field.
WITH user_info AS (
SELECT
max(meta.doc ->> '_id') AS meta_id,
nullif(meta.doc #>> '{metadata,user}','') AS meta_username,
couchdb.doc ->> 'place' AS place_uuid,
couchdb.doc ->> 'contact' AS contact_uuid,
couchdb.doc ->> 'roles' AS contact_type
FROM couchdb
INNER JOIN couchdb_users_meta AS meta
ON couchdb.doc ->> 'username' = meta.doc #>> '{metadata,user}'
WHERE
couchdb.doc ->> 'type' IS NULL AND
couchdb.doc ->> 'username' IS NOT NULL
GROUP BY meta_username, place_uuid, contact_uuid,contact_type
)
SELECT
user_info.*,
nullif(doc #>> '{metadata,versions,app}','') AS app_version,
nullif(doc #>> '{device,deviceInfo,app,version}','') AS android_version_name,
nullif(doc #>> '{device,deviceInfo,software,osVersion}','') AS os_version,
nullif(doc #>> '{device,deviceInfo,software,osApiLevel}','') AS os_api_level,
nullif(doc #>> '{device,deviceInfo,software,androidVersion}','') AS android_version_number,
nullif(doc #>> '{device,deviceInfo,ram,free}','') AS free_ram,
nullif(doc #>> '{device,deviceInfo,ram,total}','') AS total_ram,
nullif(doc #>> '{device,deviceInfo,storage,free}','') AS free_storage,
nullif(doc #>> '{device,deviceInfo,storage,total}','') AS total_storage,
nullif(doc #>> '{device,deviceInfo,hardware,model}','') AS hardware_model,
nullif(doc #>> '{device,deviceInfo,hardware,device}','') AS device_name
FROM
couchdb_users_meta AS meta
INNER JOIN user_info ON
doc ->> '_id' = user_info.meta_id
Challenge: The results of the query show null for deviceInfo fields for a number of chvs. Could you assist me in figuring out the reason behind the missing info?