mirror of
https://gitlab.com/MrFry/mrfrys-node-server
synced 2025-04-01 20:24:18 +02:00
Updated alldata page
This commit is contained in:
parent
163736979f
commit
2247143ed2
2 changed files with 70 additions and 18 deletions
|
@ -99,8 +99,29 @@ app.get('/legacy', function (req, res) {
|
|||
}, 0)
|
||||
let scount = data.length
|
||||
|
||||
let grouped = data.Subjects.reduce((res, s) => {
|
||||
let sName = s.getSubjNameWithoutYear()
|
||||
if (sName) {
|
||||
if (!res[sName]) {
|
||||
res[sName] = []
|
||||
}
|
||||
res[sName].push(s)
|
||||
} else {
|
||||
res.others.push(s)
|
||||
}
|
||||
return res
|
||||
}, {
|
||||
others: []
|
||||
})
|
||||
|
||||
const ordered = {}
|
||||
Object.keys(grouped).sort().forEach((key) => {
|
||||
ordered[key] = grouped[key]
|
||||
})
|
||||
|
||||
res.render('alldata', {
|
||||
data: data,
|
||||
orderedData: ordered,
|
||||
scount: scount,
|
||||
qcount: qcount,
|
||||
siteurl: url
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue