Skip to content

Commit

Permalink
CLDR-17662 vp: spotlight Org coverage not Cldr
Browse files Browse the repository at this point in the history
- retain cldr_count as a hidden/deleted column
  • Loading branch information
srl295 committed May 29, 2024
1 parent 34fbfc0 commit 98bf1d3
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 19 deletions.
48 changes: 31 additions & 17 deletions tools/cldr-apps/js/src/esm/cldrVettingParticipation.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ 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";
const COLUMN_TITLE_CLDR_COVERAGE_COUNT = "Cldr Coverage Count";
const COLUMN_TITLE_ORG_COVERAGE_COUNT = "Org Coverage Count";
const COLUMN_TITLE_VOTED_PATH_COUNT = "Progress Vote";
const COLUMN_TITLE_VOTABLE_PATH_COUNT = "Progress Count";
const COLUMN_TITLE_PROGRESS_PERCENT = "Progress Percent";
Expand Down Expand Up @@ -56,9 +57,9 @@ const COLUMNS = [

{ title: COLUMN_TITLE_LEVEL, comment: "User level", default: null },
{
title: COLUMN_TITLE_COVERAGE_COUNT,
title: COLUMN_TITLE_ORG_COVERAGE_COUNT,
comment:
"Total number of paths that are in CLDR's coverage target for this locale",
"Total number of paths that are in Org's coverage target for this locale",
default: 0,
},
{
Expand Down Expand Up @@ -115,6 +116,12 @@ const COLUMNS = [
"User vote count, total number of path values in this locale that have a vote from this vetter, possibly including paths that are above the organization's coverage target for the locale (such as comprehensive)",
default: 0,
},
{
title: COLUMN_TITLE_CLDR_COVERAGE_COUNT,
comment:
"Total number of paths that are in CLDR's coverage target for this locale",
default: 0,
},
{
title: COLUMN_TITLE_VOTES_AUTO_IMPORT,
comment:
Expand Down Expand Up @@ -143,6 +150,7 @@ const COLUMNS = [

// Google Sheets ignores the hidden column property, so delete them instead
const DELETE_HIDDEN = true;

const HIDDEN_COLUMNS = [
COLUMN_TITLE_VOTES,
COLUMN_TITLE_VOTES_MANUAL_IMPORT,
Expand Down Expand Up @@ -202,7 +210,7 @@ function loadHandler(json) {
}

function errorHandler(err) {
cldrRetry.handleDisconnect(err, json, "", "Loading forum participation data");
cldrRetry.handleDisconnect(err, {}, "", "Loading forum participation data");
}

/**
Expand Down Expand Up @@ -345,8 +353,10 @@ async function downloadVettingParticipation(opts) {
row[columnIndex[COLUMN_TITLE_LOCALE_ID]] = locale;
row[columnIndex[COLUMN_TITLE_VOTES]] =
localeToData[locale].participation[id] || 0;
row[columnIndex[COLUMN_TITLE_COVERAGE_COUNT]] =
localeToData[locale].cov_count || 0;
row[columnIndex[COLUMN_TITLE_ORG_COVERAGE_COUNT]] =
localeToData[locale].org_count || 0;
row[columnIndex[COLUMN_TITLE_CLDR_COVERAGE_COUNT]] =
localeToData[locale].cldr_count || 0;

if (user.userlevelName === "vetter" || user.userlevelName === "guest") {
const level = "org";
Expand Down Expand Up @@ -389,17 +399,20 @@ async function downloadVettingParticipation(opts) {
});
XLSX.utils.cell_set_number_format(ws[cell], "0%");
}
// hide these columns
ws["!cols"] = [];
for (const c of HIDDEN_COLUMNS) {
ws["!cols"][columnIndex[c]] = [{ hidden: true, wch: 0 }];
}

// omit hidden columns
ws["!ref"] = ws["!ref"].replace(
XLSX.utils.encode_col(columnIndex[LAST_HIDDEN_COLUMN]),
XLSX.utils.encode_col(columnIndex[LAST_VISIBLE_COLUMN])
);
if (DELETE_HIDDEN) {
ws["!ref"] = ws["!ref"].replace(
XLSX.utils.encode_col(columnIndex[LAST_HIDDEN_COLUMN]),
XLSX.utils.encode_col(columnIndex[LAST_VISIBLE_COLUMN])
);
} else {
// hide these columns
ws["!cols"] = [];
for (const c of HIDDEN_COLUMNS) {
ws["!cols"][columnIndex[c]] = [{ hidden: true, wch: 0 }];
}
}

XLSX.utils.book_append_sheet(wb, ws, ws_name);

Expand Down Expand Up @@ -737,12 +750,13 @@ function calculateData(json) {
});
// collect missing
(languagesMissing || []).forEach((loc) => (getLocale(loc).missing = true));
participation.forEach(({ count, locale, user, cov_count }) => {
participation.forEach(({ count, locale, user, cldr_count, org_count }) => {
const e = getLocale(locale);
e.count += count;
totalCount += count;
e.participation[user] = count;
e.cov_count = cov_count; // cov_count is currently per-locale data.
e.org_count = org_count;
e.cldr_count = cldr_count;
});

return { localeToData, totalCount, uidToUser };
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,16 +116,20 @@ public void getJson(SurveyJSONWrapper r)
int count = rs.getInt("count");
String locale = rs.getString("v.locale");
String last_mod = DBUtils.toISOString(rs.getTimestamp("last_mod"));
final int cov_count =
final int cldr_count =
covcounter.countPathsInCoverage(
Organization.cldr, CLDRLocale.getInstance(locale));
final Organization userOrg = sm.reg.getInfo(theirId).getOrganization();
final int org_count =
covcounter.countPathsInCoverage(userOrg, CLDRLocale.getInstance(locale));
participationObj.put(
new JSONObject()
.put("user", theirId)
.put("count", count)
.put("locale", locale)
.put("last_mod", last_mod)
.put("cov_count", cov_count));
.put("cldr_count", cldr_count)
.put("org_count", org_count));
}
rs.close();
} finally {
Expand Down

0 comments on commit 98bf1d3

Please sign in to comment.