Skip to content

Commit

Permalink
Merge pull request #387 from vvadymk/fix/progress-rounding
Browse files Browse the repository at this point in the history
fix: change translation progress rounding to down
  • Loading branch information
evereq authored Jul 11, 2023
2 parents d1cd6bc + d58abbd commit 6bda4a9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions api/src/controllers/project-stats.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export default class ProjectStatsController {
const translatedCount = parseInt(s.translated, 10);
return {
localeCode: s.localeCode,
progress: _.round(translatedCount / termCount, 2),
progress: Math.floor((translatedCount / termCount) * 100) / 100,
translated: translatedCount,
total: termCount,
};
Expand Down Expand Up @@ -86,7 +86,7 @@ export default class ProjectStatsController {
const totalTranslated = _.sumBy(withDefaults, 'translated');
const localeCount = locales.length;
const totalTerms = localeCount > 0 ? termCount * localeCount : termCount;
const totalProgress = totalTerms > 0 ? _.round(totalTranslated / totalTerms, 10) : 0;
const totalProgress = totalTerms > 0 ? Math.floor((totalTranslated / totalTerms) * 100) / 100 : 0;

const projectStats = {
progress: totalProgress,
Expand Down

0 comments on commit 6bda4a9

Please sign in to comment.