From fbe9426254682cd143f8b7f341ebe29dee7cddad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ant=C3=B3n=20Molleda?= Date: Fri, 23 Jul 2021 11:32:53 -0700 Subject: [PATCH] chore: feedback --- scripts/tasks/download-translations.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/tasks/download-translations.js b/scripts/tasks/download-translations.js index a9153ac13..31710ddd2 100644 --- a/scripts/tasks/download-translations.js +++ b/scripts/tasks/download-translations.js @@ -76,10 +76,9 @@ const waitFor = (seconds) => { * @returns */ const getBuild = async (buildId) => { - const builds = await translationsApi.listProjectBuilds(PROJECT_ID); - const build = builds.data.find((item) => item.data.id === buildId); + const { data } = await translationsApi.checkBuildStatus(PROJECT_ID, buildId); - return build.data; + return data; }; /** @@ -105,7 +104,7 @@ const buildAndDownloadLink = async (projectId) => { break; } else { console.log( - `Crowdin status: Waiting ${interval} seconds (retry ${i}/${counter})` + `Crowdin status: Waiting ${interval} seconds (retry ${i}/${counter} - ${build.progress}%)` ); await waitFor(interval); } @@ -129,6 +128,7 @@ const buildAndDownloadLink = async (projectId) => { const getLatestBuildLink = async (projectId) => { const { data: builds } = await translationsApi.listProjectBuilds(projectId); + // We use the first item `builds[0]` because for some reason Crowdin only returns the latest build for this project const { data: { url }, } = await translationsApi.downloadTranslations(PROJECT_ID, builds[0].data.id);