fix(library): a roll picked at a drive root counts its frames under one spelling
The picker hands a whole drive over named `\`, which `normPath` folds to the empty root, and a row of that roll was keyed `Roll` where the reading files its counts, its walked folders and its frames under `/Roll` — one folder under two names. Every number beside a subfolder of a picked drive read nought, and the spinner of a reading stood on the roll's own row and nowhere it was reading. The row key is the roll's own spelling again, and so is the path `relOf` hands back for a row under it: a reading kept to one folder of a drive root asks for `/Roll`, and `sub` counted from the old `Roll/` merged nothing. Both are the spelling the check at the foot of `scripts/tree-scan-check.mjs` asks for, and it is green again. A bounded reading also measured itself against `\/Roll` spelled from the raw name, which no id is filed under: `held` stood at nought and the line read the catalogue's whole roll as the ground it was climbing from. It is built from `normPath` of both, the way an id is.
This commit is contained in:
@@ -1586,7 +1586,6 @@ function Catalogue({ admin, user }: { admin: boolean; user: User | null }) {
|
||||
const normRoot = normPath(rootName);
|
||||
const normKey = normPath(key);
|
||||
if (normKey === normRoot) return '';
|
||||
if (normRoot === '') return `${normKey}/`;
|
||||
if (normKey.startsWith(`${normRoot}/`)) return `${normKey.slice(normRoot.length + 1)}/`;
|
||||
return null;
|
||||
},
|
||||
@@ -1766,7 +1765,7 @@ function Catalogue({ admin, user }: { admin: boolean; user: User | null }) {
|
||||
// indented rows have to come in.
|
||||
for (const dir of [...(foldersUnder.get(lowerF) ?? [])].sort((a, b) => a.localeCompare(b))) {
|
||||
const parts = dir.split('/');
|
||||
const key = normF ? `${normF}/${dir}` : dir;
|
||||
const key = `${normF}/${dir}`;
|
||||
out.push({
|
||||
key,
|
||||
label: parts[parts.length - 1],
|
||||
|
||||
@@ -1390,7 +1390,11 @@ export async function scanFolder(
|
||||
// been read once before is a reading of a hundred thousand frames even while
|
||||
// the walk is still up in its first folders, and one kept to a subfolder is
|
||||
// measured against the frames under that one alone.
|
||||
const heldPrefix = `${folder.name}/${from}`.toLowerCase();
|
||||
// An id is `normPath(folder.name)/…`, and a drive root is named `\`, which
|
||||
// `normPath` spells `''` — so the frames of such a roll's subfolder are filed
|
||||
// under `/Roll/…`, and a prefix built as `${folder.name}/${from}` spells
|
||||
// `\/Roll` and counts nought of them held.
|
||||
const heldPrefix = `${normPath(folder.name)}/${normPath(from)}`.toLowerCase();
|
||||
const held = bounded
|
||||
? rawKnown.filter((p) => p.id.toLowerCase().startsWith(heldPrefix)).length
|
||||
: rawKnown.length;
|
||||
|
||||
Reference in New Issue
Block a user