alphabetically ordering subjects on menu list

This commit is contained in:
MrFry 2020-01-10 16:21:24 +01:00
parent 73d465213c
commit 1e1a179e80

View file

@ -256,7 +256,7 @@
this.A = SUtils.SimplifyAnswer(a)
try {
this.I = JSON.parse(i).sort((a, b) => {
return a > b
return a.localeCompare(b)
})
} catch (e) {
this.I = i
@ -352,9 +352,9 @@
getSubjNameWithoutYear () {
let t = this.Name.split(' - ')
if (t[0].match(/^[0-9]{4}\/[0-9]{2}\/[0-9]{1}$/i)) {
return t[1] || ''
return t[1] || this.Name
} else {
return ''
return this.Name
}
}
@ -684,7 +684,7 @@
if (logElementGetting) { Log('testing if question is grab-box') }
let results = this.GetFormResult() // getting results element
let t = results[i].getElementsByClassName('dragitems')[0].childNodes
if (t.length !== 1) { Log('grab box drag items group length is not 1!') }
if (t.length !== 1) { Log('grab box drag items group length is not 1!'); console.log(results[i].getElementsByClassName('dragitems')[0]) }
let placedItems = t[0].getElementsByClassName('placed')
let res = []
for (let i = 0; i < placedItems.length; i++) {
@ -777,7 +777,7 @@
// "húzza oda ..." skip
fun.push((i) => {
let temp = RPM.GetAnswersFromGrabBox(i)
console.log('GRABBOX TEST')
console.log('GRABBOX TEST') // TODO: remove
console.log(temp)
return temp.map((x) => {
return x.text
@ -1125,6 +1125,7 @@
}
r.AddSubject(s)
}
data = r
count = allCount + 1 // couse starting with -1 to show errors
@ -1333,8 +1334,6 @@
function SearchSameQuestion (questionData, quiz, i) {
var r = questionData.Search(quiz[i])
console.log(quiz[i], r) // TODO: remove
let count = 0
r.forEach((item) => {
if (item.match > minResultMatchPercent) {
@ -1941,6 +1940,13 @@
others: []
})
const ordered = {}
Object.keys(grouped).sort().forEach((key) => {
ordered[key] = grouped[key]
})
grouped = ordered
let collapsibles = []
Object.entries(grouped).forEach(([subjName, subjGroup]) => {