From 924869995e9071ccc841708e81267746177821e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20FAMIBELLE-PRONZOLA?= Date: Wed, 25 May 2022 06:40:50 +0400 Subject: [PATCH] Add translations stats --- src/api/stats/controllers/stats.js | 69 +++++++++++++++++++++++++++++- 1 file changed, 68 insertions(+), 1 deletion(-) diff --git a/src/api/stats/controllers/stats.js b/src/api/stats/controllers/stats.js index 49fc8f1..3c906e0 100644 --- a/src/api/stats/controllers/stats.js +++ b/src/api/stats/controllers/stats.js @@ -4,6 +4,73 @@ module.exports = { async count(ctx, next) { const countArtiste = await strapi.entityService.count('api::artiste.artiste') const countParole = await strapi.entityService.count('api::parole.parole') - return {countArtiste, countParole} + const countParoleWithoutFrancais = await strapi.entityService.count('api::parole.parole', { + filters: { + traductions: { + francais: { + $null: true + } + } + } + }) + + const countParoleWithoutAnglais = await strapi.entityService.count('api::parole.parole', { + filters: { + traductions: { + anglais: { + $null: true + } + } + } + }) + + const countParoleWithoutEspagnol = await strapi.entityService.count('api::parole.parole', { + filters: { + traductions: { + espagnol: { + $null: true + } + } + } + }) + + const countParoleWithoutAllemand = await strapi.entityService.count('api::parole.parole', { + filters: { + traductions: { + allemand: { + $null: true + } + } + } + }) + + const countParoleWithoutItalien = await strapi.entityService.count('api::parole.parole', { + filters: { + traductions: { + italien: { + $null: true + } + } + } + }) + + const artistesWithoutBio = await strapi.entityService.count('api::artiste.artiste', { + filters: { + biographie: { + $null: true + } + } + }) + + const parolesWithoutTranslation = { + francais: countParoleWithoutFrancais - 1, // -1 Car la transcription d'une parole est déjà en francais (Micajah - Va là-bas) + anglais: countParoleWithoutAnglais, + espagnol: countParoleWithoutEspagnol, + allemand: countParoleWithoutAllemand, + italien: countParoleWithoutItalien, + } + + console.log('artisteWithoutBio', artistesWithoutBio) + return {countArtiste, countParole, artistesWithoutBio, parolesWithoutTranslation} } }