Skip to content

Commit

Permalink
CLDR-17662 vp: add vetters-per-locale and locales-per-vetter column
Browse files Browse the repository at this point in the history
  • Loading branch information
srl295 committed May 29, 2024
1 parent 4eb8f96 commit ac924f7
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions tools/cldr-apps/js/src/esm/cldrVettingParticipation.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ import * as XLSX from "xlsx";
const COLUMN_TITLE_ORG = "Org";
const COLUMN_TITLE_LOCALE_NAME = "Locale";
const COLUMN_TITLE_LOCALE_ID = "Code";
const COLUMN_TITLE_VETTERS_PER_LOCALE = "/Vetters";
const COLUMN_TITLE_LOCALES_PER_VETTER = "/Locales";
const COLUMN_TITLE_LEVEL = "Level";
const COLUMN_TITLE_VOTES = "Votes";
const COLUMN_TITLE_COVERAGE_COUNT = "Cldr Coverage Count";
Expand All @@ -39,6 +41,11 @@ const COLUMNS = [
{ title: COLUMN_TITLE_ORG, comment: "User organization", default: null },
{ title: COLUMN_TITLE_LOCALE_NAME, comment: "User locale", default: null },
{ title: COLUMN_TITLE_LOCALE_ID, comment: "User locale code", default: null },

{ title: COLUMN_TITLE_VETTERS_PER_LOCALE, comment: "Vetters per Locale", default: 0 },
{ title: COLUMN_TITLE_LOCALES_PER_VETTER, comment: "Locales per this Vetter", default: 0 },


{ title: COLUMN_TITLE_LEVEL, comment: "User level", default: null },
{
title: COLUMN_TITLE_VOTES,
Expand Down Expand Up @@ -233,6 +240,17 @@ async function downloadVettingParticipation(opts) {

let userNo = 0;
setProgress(0, userCount);
let allLocalesCount = 0;

const vettersPerLocale = [];
for (const [,{locales, allLocales}] of Object.entries(uidToUser)) {
for(const locale of locales ?? []) {
vettersPerLocale[locale] = (vettersPerLocale[locale] ?? 0) + 1;
}
if (allLocales) {
allLocalesCount++:
}
}

for (const [id, user] of Object.entries(uidToUser)) {
userNo++;
Expand All @@ -243,6 +261,7 @@ async function downloadVettingParticipation(opts) {
row[columnIndex[COLUMN_TITLE_LOCALE_ID]] = "*";
row[columnIndex[COLUMN_TITLE_VOTED_PATH_COUNT]] = "-";
row[columnIndex[COLUMN_TITLE_VOTABLE_PATH_COUNT]] = "-";
row[columnIndex[COLUMN_TITLE_VETTERS_PER_LOCALE]] = allLocalesCount;
ws_data.push(row);
} else if (!user.locales) {
// no locales?!
Expand All @@ -252,7 +271,9 @@ async function downloadVettingParticipation(opts) {
row[columnIndex[COLUMN_TITLE_VOTABLE_PATH_COUNT]] = "-";
ws_data.push(row);
} else {
row[columnIndex[COLUMN_TITLE_LOCALES_PER_VETTER]] = user.locales.length;
for (const locale of user.locales) {
row[columnIndex[COLUMN_TITLE_VETTERS_PER_LOCALE]] = vettersPerLocale[locale];
row[columnIndex[COLUMN_TITLE_LOCALE_NAME]] =
cldrLoad.getLocaleName(locale);
row[columnIndex[COLUMN_TITLE_LOCALE_ID]] = locale;
Expand Down

0 comments on commit ac924f7

Please sign in to comment.