This commit is contained in:
adueck 2022-10-12 13:09:23 +05:00
parent a976b60f20
commit c9fac35ee3
6 changed files with 12 additions and 10 deletions

View File

@ -20,7 +20,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: '14.x'
node-version: 16
- run: npm install -g firebase-tools
- run: |
cp .npmrc functions

View File

@ -22,7 +22,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: '14.x'
node-version: 16
- run: npm install -g firebase-tools
- name: build functions
run: |

View File

@ -15,7 +15,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 14
node-version: 16
- name: Check if version has been updated
id: check
uses: EndBug/version-check@v1

View File

@ -27,7 +27,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: '12.x'
node-version: 16
- run: yarn install
- run: yarn build
- run: yarn test

View File

@ -2,8 +2,7 @@
ui-debug.log
# Compiled JavaScript files
lib/**/*.js
lib/**/*.js.map
lib
# TypeScript v1 declaration files
typings/

View File

@ -98,19 +98,22 @@ async function getRawEntries(): Promise<T.DictionaryEntry[]> {
async function deleteRow(r: number) {
await rows[r].delete();
}
const entries = makeEntries(rows, deleteRow);
return entries;
return await makeEntries(rows, deleteRow);
}
function makeEntries(rows: any[], deleteRow: (r: number) => Promise<void>): T.DictionaryEntry[] {
async function makeEntries(rows: any[], deleteRow: (r: number) => Promise<void>): Promise<T.DictionaryEntry[]> {
const entries: T.DictionaryEntry[] = [];
let sheetIndex = 0;
for (let i = 0; i < rows.length; i++) {
sheetIndex++;
const row = rows[i];
const nextRow = rows[i+1] || undefined;
if (row.ts === nextRow?.ts) {
if (row.p !== nextRow.p) throw new Error(`ts ${row.ts} is a duplicate of a different entry`);
// this looks like a duplicate entry made by the sheets api
// delete it and keep going
deleteRow(i);
await deleteRow(sheetIndex);
sheetIndex--;
continue;
}
const e: T.DictionaryEntry = {