diff options
| author | Sam Wilkins <35748010+samwilkins333@users.noreply.github.com> | 2020-02-12 14:45:23 -0500 |
|---|---|---|
| committer | Sam Wilkins <35748010+samwilkins333@users.noreply.github.com> | 2020-02-12 14:45:23 -0500 |
| commit | f94747ea7ee6e51ad2c1efc780e531313ea1a3b9 (patch) | |
| tree | 0324e6ed7e6393e1b33dce0d6ea7e9400098ed33 | |
| parent | 44808c5ffc4ed9d3859dfd28cd59f7f3b3621cfc (diff) | |
importer tweaks
| -rw-r--r-- | src/client/documents/Documents.ts | 3 | ||||
| -rw-r--r-- | src/scraping/buxton/final/BuxtonImporter.ts | 9 |
2 files changed, 6 insertions, 6 deletions
diff --git a/src/client/documents/Documents.ts b/src/client/documents/Documents.ts index cc18dc0a6..24dd9ae91 100644 --- a/src/client/documents/Documents.ts +++ b/src/client/documents/Documents.ts @@ -383,8 +383,9 @@ export namespace Docs { Utils.AddServerHandler(_socket, MessageStore.BuxtonImportComplete, ({ deviceCount, errorCount }) => { _socket.off(MessageStore.BuxtonDocumentResult.Message); _socket.off(MessageStore.BuxtonImportComplete.Message); - alert(`Successfully imported ${deviceCount} device${deviceCount === 1 ? "" : "s"}, with ${errorCount} error${errorCount === 1 ? "" : "s"}.`); + alert(`Successfully imported ${deviceCount} device${deviceCount === 1 ? "" : "s"}, with ${errorCount} error${errorCount === 1 ? "" : "s"}, in ${(Date.now() - startTime) / 1000} seconds.`); }); + const startTime = Date.now(); Utils.Emit(_socket, MessageStore.BeginBuxtonImport, ""); return parent; } diff --git a/src/scraping/buxton/final/BuxtonImporter.ts b/src/scraping/buxton/final/BuxtonImporter.ts index d9d48d68c..f9726872c 100644 --- a/src/scraping/buxton/final/BuxtonImporter.ts +++ b/src/scraping/buxton/final/BuxtonImporter.ts @@ -115,7 +115,7 @@ const RegexMap = new Map<keyof DeviceDocument, Processor<any>>([ }], ["year", { exp: /Year:\s+([^\|]*)\s+\|/, - transformer: Utilities.numberValue + transformer: (raw: string) => Utilities.numberValue(/[0-9]{4}/.exec(raw)![0]) }], ["primaryKey", { exp: /Primary:\s+(.*)(Secondary|Additional):/, @@ -254,10 +254,9 @@ async function extractFileContents(pathToDocument: string): Promise<DocumentCont strictEqual(length % 3 === 0, true, "Improper caption formatting."); for (let i = 3; i < captionTargets.length; i += 3) { - const [image, fileName, caption] = captionTargets.slice(i, i + 3); - strictEqual(image, "", `The image cell in one row was not the empty string: ${image}`); - captions.push(caption); - embeddedFileNames.push(fileName); + const row = captionTargets.slice(i, i + 3); + captions.push(row[1]); + embeddedFileNames.push(row[2]); } // extract all hyperlinks embedded in the document |
