Skip to content

Commit

Permalink
handle null instance region codes
Browse files Browse the repository at this point in the history
  • Loading branch information
tomasholderness committed Jun 11, 2018
1 parent 8cabf38 commit 8ca1b9e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
- implemented new notification architecture
- requires cognicity-server v3.0.6 or later
- handle null instance region codes
2 changes: 1 addition & 1 deletion schema/reports/grasp/grasp.functions.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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 ||'"}');
Expand Down

0 comments on commit 8ca1b9e

Please sign in to comment.