Skip to content

Commit

Permalink
Create versions and update list
Browse files Browse the repository at this point in the history
  • Loading branch information
bosschaert committed Apr 5, 2024
1 parent ca9341f commit 4c8796d
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions blocks/edit/da-versions/da-versions.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,12 +104,18 @@ export default class DaVersions extends LitElement {
}

aggregateList(list) {
// for (let i = 0; i < list.length; i += 1) {
// if (!list[i].timestamp) {
// list[i].timestamp = 1;
// }
// }
// make sure each element has a timestamp
list.forEach((l) => { if (!l.timestamp) { l.timestamp = 1; } });
// and sort by timestamp
list.sort((a, b) => b.timestamp - a.timestamp);

let noResStart;
for (let i = 0; i < list.length; i += 1) {
if (!list[i].timestamp) {
list[i].timestamp = 1;
}

if (!list[i].url && noResStart === undefined) {
noResStart = i;
}
Expand Down Expand Up @@ -216,6 +222,8 @@ export default class DaVersions extends LitElement {
// eslint-disable-next-line no-console
console.log('Unable to create version', res.status);
}

this.requestUpdate();
}

async restoreVersion() {
Expand Down

0 comments on commit 4c8796d

Please sign in to comment.