mirror of
https://github.com/LCPQ/QUESTDB_website.git
synced 2024-12-25 05:43:46 +01:00
Rewriting of publication sort method using array
This commit is contained in:
parent
ec92f2d802
commit
2186f849a5
@ -123,7 +123,8 @@ draft: false
|
||||
window.defaultDats = window.defaultDats.sort((datfa, datfb) => {
|
||||
const articleA = datfa.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
|
||||
}
|
||||
else if (!doiCache.has(articleA)) {
|
||||
@ -133,9 +134,11 @@ draft: false
|
||||
return -1
|
||||
}
|
||||
else {
|
||||
const puba = doiCache.get(articleA).format('data', { format: 'object' })[0]
|
||||
const pubb = doiCache.get(articleB).format('data', { format: 'object' })[0]
|
||||
return pubUtils.getIssuedDate(puba) - pubUtils.getIssuedDate(pubb)
|
||||
const dateArr = artArr.map((art)=>{
|
||||
const pub = doiCache.get(art).format('data', { format: 'object' })[0]
|
||||
return pubUtils.getIssuedDate(pub)
|
||||
})
|
||||
return dateArr[0] - dateArr[1]
|
||||
}
|
||||
})
|
||||
processingIndicator.isActive = false
|
||||
|
Loading…
Reference in New Issue
Block a user