Skip to content

Commit

Permalink
fix: crate commit hash parse bug (risc0#1662)
Browse files Browse the repository at this point in the history
  • Loading branch information
nahoc authored Apr 12, 2024
1 parent 133b8ce commit ffe2995
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions ghpages/dev/crate-validation/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,16 @@

async function findMostRecentHash() {
return await fetch("results/index.json")
.then(res => res.json())
.then(res => res.text())
.then(data => {
// Find the most recent timestamp
let mostRecent = data.reduce((prev, current) => (prev.timestamp > current.timestamp) ? prev : current);
const mostRecent = JSON.parse(data.replace("[,", "[")).reduce((prev, current) =>
prev.timestamp > current.timestamp ? prev : current,
);

// Retrieve the hash related to the most recent timestamp
let mostRecentHash = mostRecent.hash;

return mostRecentHash;
})
.catch(err => { console.error(err) });
Expand Down

0 comments on commit ffe2995

Please sign in to comment.