diff --git a/CHANGELOG.md b/CHANGELOG.md index 3f068ea..3c6950c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,4 +25,6 @@ CHANGE LOG - updated Travis tests to use Node v8.9.3 (production) - updated README.md minimum requirements - added 'attributes' column to local_areas -- implemented new notification architecture \ No newline at end of file +- implemented new notification architecture +- requires cognicity-server v3.0.6 or later +- handle null instance region codes \ No newline at end of file diff --git a/schema/reports/grasp/grasp.functions.sql b/schema/reports/grasp/grasp.functions.sql index 88eac9d..83f8876 100644 --- a/schema/reports/grasp/grasp.functions.sql +++ b/schema/reports/grasp/grasp.functions.sql @@ -40,7 +40,7 @@ CREATE OR REPLACE FUNCTION grasp.push_to_all_reports(varchar) FROM grasp.cards AS cards, grasp.reports AS reports WHERE cards.card_id = cardId::uuid AND reports.card_id = cardId::uuid RETURNING pkey INTO reportId; - SELECT r.tags->>'instance_region_code', r.lang INTO instanceRegionCode, lang FROM cognicity.all_reports r WHERE r.pkey = reportId; + SELECT COALESCE( NULLIF(r.tags->>'instance_region_code', ''),'null'), r.lang INTO instanceRegionCode, lang FROM cognicity.all_reports r WHERE r.pkey = reportId; SELECT c.username, c.network INTO username, network FROM grasp.cards c WHERE card_id = cardId::uuid; RETURN ('{"reportId":' || reportId || ', "instanceRegionCode":"'|| instanceRegionCode ||'", "language":"' || lang || '", "username":"' || username ||'", "network":"' || network ||'"}');