Skip to content

Commit

Permalink
fix: SKFP-1077 check if indices exist for members (#147)
Browse files Browse the repository at this point in the history
  • Loading branch information
aperron-ferlab authored May 22, 2024
1 parent 19a3eeb commit 4df26d2
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/endpoints/statistics/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,15 @@ export const fetchTopDiagnosis = async (client: Client): Promise<Diagnosis[]> =>
};

export const fetchMemberStats = async (client: Client): Promise<MembersCount> => {
if (project === PROJECT_INCLUDE) return;
const membersExists = await client.indices.exists({
index: 'members',
});

const publicMembersExists = await client.indices.exists({
index: 'members-public',
});

if (!membersExists?.body || !publicMembersExists?.body) return;

const { body: members } = await client.count({
index: 'members',
Expand Down

0 comments on commit 4df26d2

Please sign in to comment.