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} } }