get all duplicates
This commit is contained in:
parent
3872b72672
commit
2db956d5a7
|
@ -114,6 +114,7 @@ async function getRawEntries(): Promise<T.DictionaryEntry[]> {
|
||||||
const entries: T.DictionaryEntry[] = [];
|
const entries: T.DictionaryEntry[] = [];
|
||||||
// let sheetIndex = 0;
|
// let sheetIndex = 0;
|
||||||
// get the rows in order of ts for easy detection of duplicate entries
|
// get the rows in order of ts for easy detection of duplicate entries
|
||||||
|
const duplicates: Set<number> = new Set();
|
||||||
for (let i = 0; i < rows.length; i++) {
|
for (let i = 0; i < rows.length; i++) {
|
||||||
// function sameEntry(a: any, b: any): boolean {
|
// function sameEntry(a: any, b: any): boolean {
|
||||||
// return a.p === b.p && a.f === b.f && a.e === b.e;
|
// return a.p === b.p && a.f === b.f && a.e === b.e;
|
||||||
|
@ -129,9 +130,16 @@ async function getRawEntries(): Promise<T.DictionaryEntry[]> {
|
||||||
// sheetIndex--;
|
// sheetIndex--;
|
||||||
// continue;
|
// continue;
|
||||||
// } else {
|
// } else {
|
||||||
throw new Error(`ts ${row.ts} is a duplicate ts of a different entry`);
|
duplicates.add(row.ts);
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
if (duplicates.size) {
|
||||||
|
throw new Error(
|
||||||
|
`ts ${Array.from(duplicates).join(
|
||||||
|
", "
|
||||||
|
)} is a duplicate ts of a different entry`
|
||||||
|
);
|
||||||
|
}
|
||||||
const e: T.DictionaryEntry = {
|
const e: T.DictionaryEntry = {
|
||||||
i: 1,
|
i: 1,
|
||||||
ts: parseInt(row.ts),
|
ts: parseInt(row.ts),
|
||||||
|
|
Loading…
Reference in New Issue