Skip to content

Commit

Permalink
CLDR-17662 update Vetting Participation spreadsheet (#3762)
Browse files Browse the repository at this point in the history
  • Loading branch information
srl295 authored May 30, 2024
1 parent f9b3376 commit bcbb490
Show file tree
Hide file tree
Showing 8 changed files with 333 additions and 77 deletions.
5 changes: 4 additions & 1 deletion tools/cldr-apps/js/src/esm/cldrAccount.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import * as cldrAjax from "./cldrAjax.mjs";
import * as cldrDom from "./cldrDom.mjs";
import * as cldrLoad from "./cldrLoad.mjs";
import * as cldrNotify from "./cldrNotify.mjs";
import * as cldrOrganizations from "./cldrOrganizations.mjs";
import * as cldrStatus from "./cldrStatus.mjs";
import * as cldrSurvey from "./cldrSurvey.mjs";
Expand Down Expand Up @@ -194,7 +195,9 @@ function listSingleUser(email) {
}

function reallyLoad() {
getOrgsAndLevels().then(reallyReallyLoad);
getOrgsAndLevels()
.catch((e) => cldrNotify.exception(e, `loading Account Settings page`))
.then(reallyReallyLoad);
}

async function getOrgsAndLevels() {
Expand Down
6 changes: 5 additions & 1 deletion tools/cldr-apps/js/src/esm/cldrLoad.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -598,7 +598,11 @@ function shower(itemLoadInfo) {
cldrSurvey.showLoader(cldrText.get("loading"));
const curSpecial = cldrStatus.getCurrentSpecial();
cldrGui.setToptitleVisibility(curSpecial !== "menu");
specialLoad(itemLoadInfo, curSpecial, theDiv);
try {
specialLoad(itemLoadInfo, curSpecial, theDiv);
} catch (e) {
cldrNotify.exception(e, `Showing SurveyTool page ${curSpecial || ""}`);
}
}

function specialLoad(itemLoadInfo, curSpecial, theDiv) {
Expand Down
40 changes: 29 additions & 11 deletions tools/cldr-apps/js/src/esm/cldrOrganizations.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
* cldrOrganizations: handle Organization names
*/
import * as cldrAjax from "./cldrAjax.mjs";
import * as cldrClient from "./cldrClient.mjs";

let orgs = null;

Expand All @@ -15,7 +16,7 @@ let orgs = null;
* shortToDisplay - the map from short names to display names
* sortedDisplayNames - the sorted array of display names
*/
async function get() {
export async function get() {
if (orgs) {
return orgs;
}
Expand All @@ -24,11 +25,11 @@ async function get() {
.doFetch(url)
.then(cldrAjax.handleFetchErrors)
.then((r) => r.json())
.then(loadOrgs)
.catch((e) => console.error(`Error: ${e} ...`));
.then(loadOrgs);
}

function loadOrgs(json) {
/** accessible for unit testing only, to set mock data */
export function loadOrgs(json) {
if (!json.map) {
console.error("Organization list not received from server");
return null;
Expand All @@ -45,10 +46,27 @@ function loadOrgs(json) {
return orgs;
}

export {
get,
/*
* The following is meant to be accessible for unit testing only, to set mock data:
*/
loadOrgs,
};
let orgCoverage = null;

/** @internal load the orgCoverage data */
async function loadOrgCoverage() {
if (!orgCoverage) {
const client = await cldrClient.getClient();
orgCoverage = (await client.apis.organizations.getOrgCoverage()).body;
}
return orgCoverage;
}

/**
* @returns {Promise<map<string,map<string,number>>} map from each organization to a map of locale to level
*/
export async function getOrgCoverage() {
const { organization_locale_level } = await loadOrgCoverage();
return organization_locale_level;
}

/** @returns {Promise<string[]>} flat list of organizations */
export async function getTcOrgs() {
const { tc_orgs } = await loadOrgCoverage();
return tc_orgs;
}
Loading

0 comments on commit bcbb490

Please sign in to comment.