diff --git a/modules/qmining/qmining.js b/modules/qmining/qmining.js index 15a77d6..98028d3 100644 --- a/modules/qmining/qmining.js +++ b/modules/qmining/qmining.js @@ -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 diff --git a/modules/qmining/views/alldata.ejs b/modules/qmining/views/alldata.ejs index 4a9f454..9be3302 100755 --- a/modules/qmining/views/alldata.ejs +++ b/modules/qmining/views/alldata.ejs @@ -79,7 +79,7 @@ <% include aludni.ejs %> - <% for (var i = 0; i < data.Subjects.length; i++) { %> + <% Object.keys(orderedData).sort().forEach((key, i) => { %>