Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Save applicant research opt in query as view #3996

Merged
merged 2 commits into from
Nov 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions hasura.planx.uk/metadata/tables.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,9 @@
- table:
name: analytics_summary
schema: public
- table:
name: applicant_research_opt_in_view
schema: public
- table:
name: blpu_codes
schema: public
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
comment on view "public"."applicant_research_opt_in_view" is NULL;

DROP VIEW applicant_research_opt_in_view;
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
CREATE OR REPLACE VIEW applicant_research_opt_in_view AS
WITH data AS (
SELECT
ls.id,
ls.email,
ls.created_at AS application_started_at,
ls.submitted_at,
ls.data->'passport'->'data'->>'applicant.name.last' AS last_name,
ls.data->'passport'->'data'->>'applicant.name.first' AS first_name,
f.name AS flow_name,
t.name AS team_name
FROM
lowcal_sessions ls
JOIN
flows f ON ls.flow_id = f.id
JOIN
teams t ON t.id = f.team_id
WHERE
ls.data->'passport'->'data'->>'applicant.researchOptIn' = '["true"]'
)
SELECT
*
FROM
data
WHERE
last_name IS NOT NULL
AND first_name IS NOT NULL;

comment on view "public"."applicant_research_opt_in_view" is E'Temporary view to expose a list of applicants to opt in to user research during the 2024/25 pilot. Used to generate a CSV report bi-weekly.';
Loading