From fafd7348d11f5aae23bf4f02d30af4cb2a257010 Mon Sep 17 00:00:00 2001 From: zz-hh-aa Date: Tue, 10 Dec 2024 16:59:52 +0000 Subject: [PATCH] chore: tidy comments and console.logs --- .../analytics/metabase/collection/getTeamAndMetabaseId.ts | 5 ++--- .../modules/analytics/metabase/collection/service.ts | 2 -- .../analytics/metabase/collection/updateMetabaseId.ts | 2 +- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/api.planx.uk/modules/analytics/metabase/collection/getTeamAndMetabaseId.ts b/api.planx.uk/modules/analytics/metabase/collection/getTeamAndMetabaseId.ts index 8c929a1e10..dc19f54b7c 100644 --- a/api.planx.uk/modules/analytics/metabase/collection/getTeamAndMetabaseId.ts +++ b/api.planx.uk/modules/analytics/metabase/collection/getTeamAndMetabaseId.ts @@ -10,13 +10,12 @@ interface GetMetabaseId { } export const getTeamAndMetabaseId = async (name: string) => { - const lowerName = name.toLowerCase(); console.log("RUNNING getTeamAndMetabaseId..."); try { const response = await $api.client.request( gql` query GetTeamAndMetabaseId($name: String!) { - teams(where: { name: { _eq: $name } }) { + teams(where: { name: { _ilike: $name } }) { id name metabaseId: metabase_id @@ -24,7 +23,7 @@ export const getTeamAndMetabaseId = async (name: string) => { } `, { - name: lowerName, + name: name, }, ); console.log("Raw response:"); diff --git a/api.planx.uk/modules/analytics/metabase/collection/service.ts b/api.planx.uk/modules/analytics/metabase/collection/service.ts index a0c3fef8af..916aedd3cd 100644 --- a/api.planx.uk/modules/analytics/metabase/collection/service.ts +++ b/api.planx.uk/modules/analytics/metabase/collection/service.ts @@ -20,8 +20,6 @@ export async function checkCollections( const { metabaseId, id } = teamAndMetabaseId; if (metabaseId) { - console.log("Updating MetabaseId..."); - await updateMetabaseId(id, metabaseId); return metabaseId; } diff --git a/api.planx.uk/modules/analytics/metabase/collection/updateMetabaseId.ts b/api.planx.uk/modules/analytics/metabase/collection/updateMetabaseId.ts index 4b9ed57bfd..29de69e692 100644 --- a/api.planx.uk/modules/analytics/metabase/collection/updateMetabaseId.ts +++ b/api.planx.uk/modules/analytics/metabase/collection/updateMetabaseId.ts @@ -9,6 +9,7 @@ interface UpdateMetabaseId { }; } +/** Updates column `metabase_id` in the Planx DB `teams` table */ export const updateMetabaseId = async (teamId: number, metabaseId: number) => { try { const response = await $api.client.request( @@ -31,7 +32,6 @@ export const updateMetabaseId = async (teamId: number, metabaseId: number) => { metabaseId: metabaseId, }, ); - console.log({ response }); return response; } catch (e) { console.error(