10
0
mirror of https://github.com/LCPQ/QUESTDB_website.git synced 2024-11-04 13:13:55 +01:00

Rewriting of publication sort method using array

This commit is contained in:
Mickaël Véril 2020-09-09 17:58:56 +02:00
parent ec92f2d802
commit 2186f849a5

View File

@ -123,7 +123,8 @@ draft: false
window.defaultDats = window.defaultDats.sort((datfa, datfb) => { window.defaultDats = window.defaultDats.sort((datfa, datfb) => {
const articleA = datfa.article const articleA = datfa.article
const articleB = datfb.article const articleB = datfb.article
if ([articleA,articleB].every(art=>!doiCache.has(art))) { const artArr = [articleA,articleB]
if (artArr.every(art=>!doiCache.has(art))) {
return 0 return 0
} }
else if (!doiCache.has(articleA)) { else if (!doiCache.has(articleA)) {
@ -133,9 +134,11 @@ draft: false
return -1 return -1
} }
else { else {
const puba = doiCache.get(articleA).format('data', { format: 'object' })[0] const dateArr = artArr.map((art)=>{
const pubb = doiCache.get(articleB).format('data', { format: 'object' })[0] const pub = doiCache.get(art).format('data', { format: 'object' })[0]
return pubUtils.getIssuedDate(puba) - pubUtils.getIssuedDate(pubb) return pubUtils.getIssuedDate(pub)
})
return dateArr[0] - dateArr[1]
} }
}) })
processingIndicator.isActive = false processingIndicator.isActive = false