Skip to content

Commit

Permalink
Bugfix / fix tn import (#181)
Browse files Browse the repository at this point in the history
* bump version

* fix missing version

* fix missing version

---------

Co-authored-by: blm <[email protected]>
  • Loading branch information
PhotoNomad0 and blm authored Mar 11, 2024
1 parent 8fa8cad commit 0a4f31a
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "tc-source-content-updater",
"version": "1.4.23",
"version": "1.4.24",
"description": "Module that updates source content for the desktop application translationCore.",
"main": "lib/index.js",
"display": "library",
Expand Down
12 changes: 10 additions & 2 deletions src/helpers/translationHelps/tnArticleHelpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ export async function processTranslationNotes(resource, sourcePath, outputPath,
console.log(`tnArticleHelpers.processTranslationNotes() - have needed original bibles for ${sourcePath}, starting processing`);
const tsvFiles = fs.readdirSync(sourcePath).filter((filename) => path.extname(filename) === '.tsv');
const tnErrors = [];
let bookCount = 0;

for (const filename of tsvFiles) {
try {
Expand All @@ -201,8 +202,8 @@ export async function processTranslationNotes(resource, sourcePath, outputPath,
const originalLanguageBibleId = isNewTestament ? NT_ORIG_LANG_BIBLE : OT_ORIG_LANG_BIBLE;
const version = isNewTestament && ntQuery ? ('v' + ntQuery) : otQuery ? ('v' + otQuery) : null;
if (!version) {
console.warn('tnArticleHelpers.processTranslationNotes() - There was a missing version for book ' + bookId + ' of resource ' + originalLanguageBibleId + ' from ' + resource.downloadUrl);
return;
console.warn('tnArticleHelpers.processTranslationNotes() - There was a missing original language version for book ' + bookId + ' of resource ' + originalLanguageBibleId + ' from ' + resource.downloadUrl);
continue;
}
const originalBiblePath = path.join(
resourcesPath,
Expand All @@ -223,6 +224,7 @@ export async function processTranslationNotes(resource, sourcePath, outputPath,
}
convertEllipsisToAmpersand(groupData, filepath);
await formatAndSaveGroupData(groupData, outputPath, bookId);
bookCount += 1;
} else {
const resource = `${originalLanguageOwner}/${originalLanguageId}_${originalLanguageBibleId}`;
const message = `tnArticleHelpers.processTranslationNotes() - cannot find '${resource}' at ${originalBiblePath}:`;
Expand All @@ -244,6 +246,12 @@ export async function processTranslationNotes(resource, sourcePath, outputPath,
throw new Error(`${message}:\n${tnErrors.join('\n')}`);
}

if (!bookCount) {
const message = `tnArticleHelpers.processTranslationNotes() - no books could be processed in ${sourcePath}`;
console.error(message);
throw new Error(`${message}:\n${tnErrors.join('\n')}`);
}

// Generate groupsIndex using tN groupData & tA articles.
makeSureResourceUnzipped(taCategoriesPath);
const categorizedGroupsIndex = generateGroupsIndex(outputPath, taCategoriesPath);
Expand Down

0 comments on commit 0a4f31a

Please sign in to comment.