This commit is contained in:
parent
de7abbffa2
commit
a976b60f20
|
@ -7,7 +7,7 @@
|
||||||
"name": "functions",
|
"name": "functions",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@google-cloud/storage": "^5.8.1",
|
"@google-cloud/storage": "^5.8.1",
|
||||||
"@lingdocs/inflect": "5.1.2",
|
"@lingdocs/inflect": "5.1.3",
|
||||||
"@types/cors": "^2.8.10",
|
"@types/cors": "^2.8.10",
|
||||||
"@types/google-spreadsheet": "^3.0.2",
|
"@types/google-spreadsheet": "^3.0.2",
|
||||||
"@types/react": "^18.0.21",
|
"@types/react": "^18.0.21",
|
||||||
|
@ -391,9 +391,9 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@lingdocs/inflect": {
|
"node_modules/@lingdocs/inflect": {
|
||||||
"version": "5.1.2",
|
"version": "5.1.3",
|
||||||
"resolved": "https://npm.lingdocs.com/@lingdocs%2finflect/-/inflect-5.1.2.tgz",
|
"resolved": "https://npm.lingdocs.com/@lingdocs%2finflect/-/inflect-5.1.3.tgz",
|
||||||
"integrity": "sha512-1lIfxCA/nj1ZbicKgWGnGIIeB94pk3OVroXZ6mVgqRX8KFR+f/vvdyifRmOapqPA8KVLT1Z2Fv+11SKcmTmQOw==",
|
"integrity": "sha512-dDz6w/FZaO5c0ylfj6PBoe/W6VnTCUtc7Ear+GlrkHqkzFdyuWQVq+oqRn2T4gohD2rkpEAfPWay2c/uxD2m4A==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"pbf": "^3.2.1",
|
"pbf": "^3.2.1",
|
||||||
|
@ -3499,9 +3499,9 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@lingdocs/inflect": {
|
"@lingdocs/inflect": {
|
||||||
"version": "5.1.2",
|
"version": "5.1.3",
|
||||||
"resolved": "https://npm.lingdocs.com/@lingdocs%2finflect/-/inflect-5.1.2.tgz",
|
"resolved": "https://npm.lingdocs.com/@lingdocs%2finflect/-/inflect-5.1.3.tgz",
|
||||||
"integrity": "sha512-1lIfxCA/nj1ZbicKgWGnGIIeB94pk3OVroXZ6mVgqRX8KFR+f/vvdyifRmOapqPA8KVLT1Z2Fv+11SKcmTmQOw==",
|
"integrity": "sha512-dDz6w/FZaO5c0ylfj6PBoe/W6VnTCUtc7Ear+GlrkHqkzFdyuWQVq+oqRn2T4gohD2rkpEAfPWay2c/uxD2m4A==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"pbf": "^3.2.1",
|
"pbf": "^3.2.1",
|
||||||
"rambda": "^7.3.0"
|
"rambda": "^7.3.0"
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
"main": "lib/functions/src/index.js",
|
"main": "lib/functions/src/index.js",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@google-cloud/storage": "^5.8.1",
|
"@google-cloud/storage": "^5.8.1",
|
||||||
"@lingdocs/inflect": "5.1.2",
|
"@lingdocs/inflect": "5.1.3",
|
||||||
"@types/cors": "^2.8.10",
|
"@types/cors": "^2.8.10",
|
||||||
"@types/google-spreadsheet": "^3.0.2",
|
"@types/google-spreadsheet": "^3.0.2",
|
||||||
"@types/react": "^18.0.21",
|
"@types/react": "^18.0.21",
|
||||||
|
|
|
@ -103,7 +103,16 @@ async function getRawEntries(): Promise<T.DictionaryEntry[]> {
|
||||||
}
|
}
|
||||||
|
|
||||||
function makeEntries(rows: any[], deleteRow: (r: number) => Promise<void>): T.DictionaryEntry[] {
|
function makeEntries(rows: any[], deleteRow: (r: number) => Promise<void>): T.DictionaryEntry[] {
|
||||||
const entries: T.DictionaryEntry[] = rows.map((row): T.DictionaryEntry => {
|
const entries: T.DictionaryEntry[] = [];
|
||||||
|
for (let i = 0; i < rows.length; i++) {
|
||||||
|
const row = rows[i];
|
||||||
|
const nextRow = rows[i+1] || undefined;
|
||||||
|
if (row.ts === nextRow?.ts) {
|
||||||
|
// this looks like a duplicate entry made by the sheets api
|
||||||
|
// delete it and keep going
|
||||||
|
deleteRow(i);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
const e: T.DictionaryEntry = {
|
const e: T.DictionaryEntry = {
|
||||||
i: 1,
|
i: 1,
|
||||||
ts: parseInt(row.ts),
|
ts: parseInt(row.ts),
|
||||||
|
@ -121,8 +130,8 @@ function makeEntries(rows: any[], deleteRow: (r: number) => Promise<void>): T.Di
|
||||||
dictionaryEntryBooleanFields.forEach((field: T.DictionaryEntryBooleanField) => {
|
dictionaryEntryBooleanFields.forEach((field: T.DictionaryEntryBooleanField) => {
|
||||||
if (row[field]) e[field] = true;
|
if (row[field]) e[field] = true;
|
||||||
});
|
});
|
||||||
return standardizeEntry(e);
|
entries.push(standardizeEntry(e));
|
||||||
});
|
}
|
||||||
// add alphabetical index
|
// add alphabetical index
|
||||||
entries.sort((a, b) => a.p.localeCompare(b.p, "ps"));
|
entries.sort((a, b) => a.p.localeCompare(b.p, "ps"));
|
||||||
const entriesLength = entries.length;
|
const entriesLength = entries.length;
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
"private": true,
|
"private": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@fortawesome/fontawesome-free": "^5.15.2",
|
"@fortawesome/fontawesome-free": "^5.15.2",
|
||||||
"@lingdocs/ps-react": "5.1.2",
|
"@lingdocs/ps-react": "5.1.3",
|
||||||
"@testing-library/jest-dom": "^5.11.4",
|
"@testing-library/jest-dom": "^5.11.4",
|
||||||
"@testing-library/react": "^11.1.0",
|
"@testing-library/react": "^11.1.0",
|
||||||
"@testing-library/user-event": "^12.1.10",
|
"@testing-library/user-event": "^12.1.10",
|
||||||
|
|
|
@ -2349,10 +2349,10 @@
|
||||||
"@jridgewell/resolve-uri" "^3.0.3"
|
"@jridgewell/resolve-uri" "^3.0.3"
|
||||||
"@jridgewell/sourcemap-codec" "^1.4.10"
|
"@jridgewell/sourcemap-codec" "^1.4.10"
|
||||||
|
|
||||||
"@lingdocs/ps-react@5.1.2":
|
"@lingdocs/ps-react@5.1.3":
|
||||||
version "5.1.2"
|
version "5.1.3"
|
||||||
resolved "https://npm.lingdocs.com/@lingdocs%2fps-react/-/ps-react-5.1.2.tgz#16f318208e46010b069ba06ffec88b3c85c398be"
|
resolved "https://npm.lingdocs.com/@lingdocs%2fps-react/-/ps-react-5.1.3.tgz#84a6e4eef606cdd73f818d2c5f5ebabd5c989ffe"
|
||||||
integrity sha512-Nyq/ACZej0BcV/3ePIH0CJRoCq/Ekw7gFHp8JFPBMUzYQcgLOB+Ad64CqsTNnljGzOQNEGsDQPz1+upO3Lux+g==
|
integrity sha512-qLlTLr56zSWd5xWgVk/2EynSWwsTwOu1/9tfkIbzWGDzo8xPXONqhDdpNpK7xhyj4RrUZqwtflym4FOjrdNa1g==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@formkit/auto-animate" "^1.0.0-beta.3"
|
"@formkit/auto-animate" "^1.0.0-beta.3"
|
||||||
classnames "^2.2.6"
|
classnames "^2.2.6"
|
||||||
|
|
Loading…
Reference in New Issue