Add verification sorting

This commit is contained in:
Yarmo Mackenbach 2020-06-29 10:46:45 +02:00
parent 83901f06a1
commit 60ef35fd79

View file

@ -158,6 +158,10 @@ async function verifyProofs(opts) {
verifications.push(await verifyProof(notation[1], keyData.fingerprint)); verifications.push(await verifyProof(notation[1], keyData.fingerprint));
} }
// One-line sorting function (order verifications by type)
console.log(keyData.notations);
verifications = verifications.sort((a,b) => (a.type > b.type) ? 1 : ((b.type > a.type) ? -1 : 0));
// Generate feedback // Generate feedback
feedback += `<p>`; feedback += `<p>`;
for (var i = 0; i < verifications.length; i++) { for (var i = 0; i < verifications.length; i++) {
@ -191,6 +195,10 @@ async function displayProfile(opts) {
verifications.push(await verifyProof(notation[1], keyData.fingerprint)); verifications.push(await verifyProof(notation[1], keyData.fingerprint));
} }
// One-line sorting function (order verifications by type)
console.log(keyData.notations);
verifications = verifications.sort((a,b) => (a.type > b.type) ? 1 : ((b.type > a.type) ? -1 : 0));
// Generate feedback // Generate feedback
feedback += `<div class="profileDataItem profileDataItem--separator profileDataItem--noLabel">`; feedback += `<div class="profileDataItem profileDataItem--separator profileDataItem--noLabel">`;
feedback += `<div class="profileDataItem__label"></div>`; feedback += `<div class="profileDataItem__label"></div>`;