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

Performance improvement; don't use the data files for the generation but only the YAML of the publications page

This commit is contained in:
Mickaël Véril 2020-09-11 09:32:13 +02:00
parent ea0db71417
commit 942fba5f7f

View File

@ -21,24 +21,23 @@ draft: false
<script> <script>
window.onload = async function () { window.onload = async function () {
processingIndicator.isActive = true processingIndicator.isActive = true
var div = document.getElementById("publis_div") const setsSec = $('#publis_sets')
const Cite = require("citation-js") const Cite = require("citation-js")
const sarticles = uniq(Object.values(await loadAllData()).flat().filter(d => d.article !== null).map(d => d.article))
const spubliscite = await Cite.async(sarticles)
const uospublis = spubliscite.format('data', { format: 'object' })
const spublis = uospublis.sort((puba, pubb) => pubUtils.getIssuedDate(puba) - pubUtils.getIssuedDate(pubb))
var myDB = await publiDB.loadAsync() var myDB = await publiDB.loadAsync()
for (const publi of spublis) { const sets = myDB.sets
var art = await createPubliUI(publi, true, true) for (const [setName,publis] of sets) {
var setName = myDB.findSetNameFromArticle(publi.DOI, true) const publiscite = await Cite.async(publis)
setsSec = $('#publis_sets') const uopublis = publiscite.format('data', { format: 'object' })
var mySetSec = setsSec.find(`section.publiSet[data-setName="${setName}"]`) if (uopublis.length !== 0) {
if (mySetSec.length === 0) { const mySetSec = $('<section>').addClass('publiSet').attr("data-setName", setName).appendTo(setsSec)
mySetSec = $('<section>').addClass('publiSet').attr("data-setName", setName).appendTo(setsSec)
$("<h1>").text(setName).appendTo(mySetSec) $("<h1>").text(setName).appendTo(mySetSec)
} const spublis = uopublis.sort((puba, pubb) => pubUtils.getIssuedDate(puba) - pubUtils.getIssuedDate(pubb))
for (const publi of spublis) {
const art = await createPubliUI(publi, true, true)
$(art).appendTo(mySetSec) $(art).appendTo(mySetSec)
} }
}
}
const odois = myDB.others const odois = myDB.others
const opubliscite = await Cite.async(odois) const opubliscite = await Cite.async(odois)
const uoopublis = opubliscite.format('data', { format: 'object' }) const uoopublis = opubliscite.format('data', { format: 'object' })