From 59c169ce2e3ccff93d1c728176c34a0fda8b6825 Mon Sep 17 00:00:00 2001 From: Ross Date: Sat, 6 Nov 2021 18:35:18 +0000 Subject: [PATCH] . --- rapids/templates/rapids/rapid_form.html | 28 +++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/rapids/templates/rapids/rapid_form.html b/rapids/templates/rapids/rapid_form.html index db5403c5..218354aa 100755 --- a/rapids/templates/rapids/rapid_form.html +++ b/rapids/templates/rapids/rapid_form.html @@ -271,16 +271,32 @@ listAllFilesAndDirs(monitor_directory_handler).then(async function ( items) { files_to_add = new Set(); + current_files = getCurrentFiles(); + current_files_tuple = new Set() + for (let elem of current_files) { + current_files_tuple.add([elem.size, elem.name, + elem.lastModified + ]); + } + for (var i = 0; i < items.length; i++) { - files_to_add.add(await items[i].handle - .getFile()); + f = await items[i].handle.getFile() + if (!current_files_tuple.has([f.size, f.name, f + .lastModified + ])) { + files_to_add.add(f); + } } - current_files = getCurrentFiles(); - let distinct_set = new Set([...files_to_add].filter( - x => !current_files.has(x))); - console.log(files_to_add, current_files, distinct_set); + // file objects differ enough that the following does not work + //let distinct_set = new Set([...files_to_add].filter( + // x => !current_files.has(x))); + + + + console.log(files_to_add, current_files, + distinct_set); extendInputs(distinct_set.size); distinct_set.forEach((file) => {