Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix / remove bundled pre release content #7614

Merged
merged 3 commits into from
Dec 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
97 changes: 61 additions & 36 deletions scripts/resources/updateResources.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,24 +115,44 @@ function isAlignedBible(item) {
return false;
}

function checkForPreProdSubst(preProd, keep, item, preProdDcsResourceList, useItem) {
if (preProd && keep && item.languageId === 'en') {
// switch for preProdEquivalent
const match = preProdDcsResourceList.find(preItem => (
(item.languageId === preItem.languageId)
&& (item.owner === preItem.owner)
&& (item.resourceId === preItem.resourceId)
));

if (match) {
useItem = match;
}
}
return useItem;
}

/**
* strip list down to minimal resources if in filterOrg, original language and optionally English
* @param {object} sourceContentUpdater
* @param {string} filterOrg
* @param {string[]} updateList
* @param {boolean} addEnglishRes
* @param {object[]} dcsResourcesList
* @param {object[]} updateList
* @param {string[]} keyLanguages
* @param {boolean} preProd
* @param {object[]} preProdDcsResourceList
*/
function getNeededResources(sourceContentUpdater, updateList, keyLanguages) {
for (const item of sourceContentUpdater.updatedCatalogResources) {
function getNeededResources(dcsResourcesList, updateList, keyLanguages, preProd, preProdDcsResourceList) {
for (const item of dcsResourcesList) {
let keep = false;
let useItem = item;

switch (item.owner) {
case DOOR43_CATALOG:
keep = isCoreResource(item);
useItem = checkForPreProdSubst(preProd, keep, item, preProdDcsResourceList, useItem);
break;

case UNFOLDING_WORD:
keep = isCoreResource(item) || isAlignedBible(item) || isKeyLanguageResource(item, keyLanguages);
useItem = checkForPreProdSubst(preProd, keep, item, preProdDcsResourceList, useItem);
break;

default: // other orgs
Expand All @@ -141,7 +161,7 @@ function getNeededResources(sourceContentUpdater, updateList, keyLanguages) {
}

if (keep) {
updateList.push(item);
updateList.push(useItem);
}
}
}
Expand Down Expand Up @@ -190,46 +210,51 @@ const updateResources = async (languages, resourcesPath, allAlignedBibles, uWori
config.filterByOwner = filterByOwner_;
}

okToZip = true;
let preProdDcsResourceList = []

if (preProd) {
config.stage = STAGE.PRE_PROD;
await sourceContentUpdater.getLatestResources(localResourceList, config);
preProdDcsResourceList = [...sourceContentUpdater.updatedCatalogResources]
delete config.stage; // so next fetch will only get released
}

okToZip = true;
await sourceContentUpdater.getLatestResources(localResourceList, config);
const dcsResourcesList = sourceContentUpdater.updatedCatalogResources

await sourceContentUpdater.getLatestResources(localResourceList, config)
.then(async () => {
let updateList = [];
console.log(`Updated resources count is ${sourceContentUpdater.updatedCatalogResources?.length}`)
let updateList = [];
console.log(`Updated resources count is ${sourceContentUpdater.updatedCatalogResources?.length}`);

if (_UW) {
getNeededResources(sourceContentUpdater, updateList, languages);
} else {
updateList = sourceContentUpdater.updatedCatalogResources;
}
if (_UW) {
getNeededResources(dcsResourcesList, updateList, languages, preProd, preProdDcsResourceList);
} else {
updateList = dcsResourcesList;
}

cleanUpLoadAfterResources(updateList);
cleanUpLoadAfterResources(updateList);

await sourceContentUpdater.downloadResources(languages, resourcesPath,
updateList, // list of static resources that are newer in catalog
allAlignedBibles)
.then(resources => {
if (!resources || !resources.length) {
console.log('Resources are already up to date');
}
await sourceContentUpdater.downloadResources(languages, resourcesPath,
updateList, // list of static resources that are newer in catalog
allAlignedBibles)
.then(resources => {
if (!resources || !resources.length) {
console.log('Resources are already up to date');
}

resources.forEach(resource => {
console.log('Updated resource \'' + resource.resourceId + '\' for language \'' + resource.languageId + '\' to v' + resource.version);
const found = languages.find((language) => (language === resource.languageId));
resources.forEach(resource => {
console.log('Updated resource \'' + resource.resourceId + '\' for language \'' + resource.languageId + '\' to v' + resource.version);
const found = languages.find((language) => (language === resource.languageId));

if (!found) { // if language for resource was not in original list, then add it for language list to zip up
languages.push(resource.languageId);
}
});
})
.catch(err => {
console.error(err);
});
if (!found) { // if language for resource was not in original list, then add it for language list to zip up
languages.push(resource.languageId);
}
});
})
.catch(err => {
console.error(err);
});

return sourceContentUpdater.getLatestDownloadErrorsStr();
} catch (e) {
const message = `Error getting latest resources: `;
Expand Down
Binary file not shown.
Binary file not shown.
Binary file modified tcResources/en/bibles/ult/v84.1_Door43-Catalog/books.zip
Binary file not shown.
Binary file modified tcResources/en/bibles/ult/v84.1_unfoldingWord/books.zip
Binary file not shown.
Binary file modified tcResources/en/bibles/ust/v84.1_Door43-Catalog/books.zip
Binary file not shown.
Binary file modified tcResources/en/bibles/ust/v84.1_unfoldingWord/books.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -708,5 +708,6 @@
],
"version": "84.1",
"catalog_modified_time": "2024-08-15T16:21:53Z",
"modifiedTime": "2024-08-15T16:21:53Z"
"modifiedTime": "2024-08-15T16:21:53Z",
"stage": "preprod"
}
Binary file modified tcResources/hbo/bibles/uhb/v2.1.30_Door43-Catalog/books.zip
Binary file not shown.
Binary file modified tcResources/hbo/bibles/uhb/v2.1.30_unfoldingWord/books.zip
Binary file not shown.
Binary file modified tcResources/hbo/bibles/uhb/v2.1.31_Door43-Catalog/books.zip
Binary file not shown.
Binary file modified tcResources/hbo/bibles/uhb/v2.1.31_unfoldingWord/books.zip
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -59,37 +59,6 @@
"4": 11,
"chapters": 4
},
"mat": {
"1": 25,
"2": 23,
"3": 17,
"4": 25,
"5": 48,
"6": 34,
"7": 29,
"8": 34,
"9": 38,
"10": 42,
"11": 30,
"12": 50,
"13": 58,
"14": 36,
"15": 39,
"16": 28,
"17": 27,
"18": 35,
"19": 30,
"20": 34,
"21": 46,
"22": 46,
"23": 39,
"24": 51,
"25": 46,
"26": 75,
"27": 66,
"28": 20,
"chapters": 28
},
"mrk": {
"1": 45,
"2": 28,
Expand Down Expand Up @@ -160,25 +129,6 @@
"21": 25,
"chapters": 21
},
"rom": {
"1": 32,
"2": 29,
"3": 31,
"4": 25,
"5": 21,
"6": 23,
"7": 25,
"8": 39,
"9": 33,
"10": 21,
"11": 36,
"12": 21,
"13": 14,
"14": 23,
"15": 33,
"16": 27,
"chapters": 16
},
"1co": {
"1": 31,
"2": 16,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
"description": "An open-licensed update of the ASV, intended to provide a 'form-centric' understanding of the Bible. It increases the translator's understanding of the lexical and grammatical composition of the underlying text by adhering closely to the word order and structure of the originals.",
"format": "text/usfm3",
"identifier": "hglt",
"issued": "2024-11-29",
"issued": "2024-11-25",
"language": {
"direction": "ltr",
"identifier": "hglt",
"title": "हिन्दी, हिंदी"
},
"modified": "2024-11-29",
"modified": "2024-11-25",
"publisher": "BCS",
"relation": [
"hi/tw",
Expand Down Expand Up @@ -40,7 +40,7 @@
"subject": "Aligned Bible",
"title": "हिन्दी भाषा शाब्दिक पाठ",
"type": "bundle",
"version": "5"
"version": "4"
},
"checking": {
"checking_entity": [
Expand Down Expand Up @@ -109,16 +109,6 @@
"bible-ot"
]
},
{
"title": "मत्ती",
"versification": "ufw",
"identifier": "mat",
"sort": 40,
"path": "./41-MAT.usfm",
"categories": [
"bible-nt"
]
},
{
"title": "मरकुस",
"versification": "ufw",
Expand Down Expand Up @@ -149,16 +139,6 @@
"bible-nt"
]
},
{
"title": "रोमियों",
"versification": "ufw",
"identifier": "rom",
"sort": 45,
"path": "./46-ROM.usfm",
"categories": [
"bible-nt"
]
},
{
"title": "1 कुरिन्थियों",
"versification": "ufw",
Expand Down Expand Up @@ -368,13 +348,13 @@
"description": "An open-licensed update of the ASV, intended to provide a 'form-centric' understanding of the Bible. It increases the translator's understanding of the lexical and grammatical composition of the underlying text by adhering closely to the word order and structure of the originals.",
"format": "text/usfm3",
"identifier": "hglt",
"issued": "2024-11-29",
"issued": "2024-11-25",
"language": {
"direction": "ltr",
"identifier": "hglt",
"title": "हिन्दी, हिंदी"
},
"modified": "2024-11-29",
"modified": "2024-11-25",
"publisher": "BCS",
"relation": [
"hi/tw",
Expand Down Expand Up @@ -402,7 +382,7 @@
"subject": "Aligned Bible",
"title": "हिन्दी भाषा शाब्दिक पाठ",
"type": "bundle",
"version": "5"
"version": "4"
},
"checking": {
"checking_entity": [
Expand Down Expand Up @@ -471,16 +451,6 @@
"bible-ot"
]
},
{
"title": "मत्ती",
"versification": "ufw",
"identifier": "mat",
"sort": 40,
"path": "./41-MAT.usfm",
"categories": [
"bible-nt"
]
},
{
"title": "मरकुस",
"versification": "ufw",
Expand Down Expand Up @@ -511,16 +481,6 @@
"bible-nt"
]
},
{
"title": "रोमियों",
"versification": "ufw",
"identifier": "rom",
"sort": 45,
"path": "./46-ROM.usfm",
"categories": [
"bible-nt"
]
},
{
"title": "1 कुरिन्थियों",
"versification": "ufw",
Expand Down Expand Up @@ -729,11 +689,11 @@
"subject": "Aligned Bible",
"resource_id": "hglt",
"resource_title": "हिन्दी भाषा शाब्दिक पाठ",
"remoteModifiedTime": "2024-11-29T12:23:24Z",
"remoteModifiedTime": "2024-11-25T08:34:51Z",
"description": "Gateway Language",
"catalog_modified_time": "2024-11-29T12:23:24Z",
"catalog_modified_time": "2024-11-25T08:34:51Z",
"usfm-js": "3.4.3",
"version": "5",
"modifiedTime": "2024-11-29T12:23:24Z",
"stage": "preprod"
"version": "4",
"modifiedTime": "2024-11-25T08:34:51Z",
"stage": "prod"
}
Binary file modified tcResources/id/bibles/glt/v100_bahtraku/books.zip
Binary file not shown.
Binary file modified tcResources/id/bibles/gst/v11_bahtraku/books.zip
Binary file not shown.
3 changes: 1 addition & 2 deletions tcResources/source-content-updater-manifest.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
{
"modified": "2024-12-11T23:25:40.236Z",
"havePreReleaseData": true
"modified": "2024-12-17T19:23:39.071Z"
}
Loading