diff options
author | June McEnroe <june@causal.agency> | 2024-09-08 19:38:22 -0400 |
---|---|---|
committer | June McEnroe <june@causal.agency> | 2024-09-08 19:38:22 -0400 |
commit | dd7fda85bcc69cd4cd35e006cffabf3bdf765104 (patch) | |
tree | 8bce611abf17a962c32c52ff4defac186b5494a7 /www | |
parent | Allow removing bodies and lenses (diff) | |
download | src-dd7fda85bcc69cd4cd35e006cffabf3bdf765104.tar.gz src-dd7fda85bcc69cd4cd35e006cffabf3bdf765104.zip |
Render trips hopefully more efficiently
Diffstat (limited to 'www')
-rw-r--r-- | www/photo.causal.agency/trips.html | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/www/photo.causal.agency/trips.html b/www/photo.causal.agency/trips.html index de34dc6c..21c308da 100644 --- a/www/photo.causal.agency/trips.html +++ b/www/photo.causal.agency/trips.html @@ -195,15 +195,16 @@ function setTrips() { localStorage.setItem("trips", JSON.stringify(trips)); let ul = document.querySelector("#trips > ul"); ul.innerHTML = ""; + let tripsByRoll = Object.groupBy(trips, trip => trip.rollId); for (let rollId = nextId - 1; rollId > 0; --rollId) { - let rollTrips = trips.filter(trip => trip.rollId == rollId); - if (rollTrips.length == 0) continue; + let rollTrips = tripsByRoll[rollId]; + if (!rollTrips) continue; let rollLi = document.createElement("li"); rollLi.appendChild(document.createTextNode(` ${rollTrips[0].film} (${rollTrips[0].body}) `)); let rollUl = document.createElement("ul"); - for (trip of rollTrips) { + for (let trip of rollTrips) { let li = document.createElement("li"); li.appendChild(document.createTextNode(` ${trip.date}: |