Subject index fix

This commit is contained in:
MrFry 2020-01-11 12:51:47 +01:00
parent 1e1a179e80
commit fd5813ae28
2 changed files with 6 additions and 15 deletions

@ -1 +1 @@
Subproject commit 100ca7750d88400b227c9e1592300c4d1ea7db5c
Subproject commit 82c5b21c7fd374b9f32887808b6a3d90f545b93e

View file

@ -254,6 +254,7 @@
constructor (q, a, i) {
this.Q = SUtils.SimplifyQuestion(q)
this.A = SUtils.SimplifyAnswer(a)
// TODO: sorting breaks image order
try {
this.I = JSON.parse(i).sort((a, b) => {
return a.localeCompare(b)
@ -328,7 +329,7 @@
}
getIndex () {
return this.index || -1
return this.index
}
get length () {
@ -777,8 +778,7 @@
// "húzza oda ..." skip
fun.push((i) => {
let temp = RPM.GetAnswersFromGrabBox(i)
console.log('GRABBOX TEST') // TODO: remove
console.log(temp)
console.log('GRABBOX TEST', temp) // TODO: remove
return temp.map((x) => {
return x.text
}).join(', ')
@ -1914,16 +1914,6 @@
subjTable.style.textAlign = 'left'
subjTable.style.width = '98%'
// var tr = subjTable.insertRow()
// var header1 = tr.insertCell()
// var headerSubjInfoParagraph = CreateNodeWithText(header1, 'Tárgynév [darab kérdés]', 'center')
// headerSubjInfoParagraph.style.margin = fiveMargin // fancy margin
// var header2 = tr.insertCell()
// var headerSubjInfoParagraph2 = CreateNodeWithText(header2, 'Aktív')
// headerSubjInfoParagraph2.style.margin = fiveMargin // fancy margin
if (data && data.length > 0) {
let grouped = data.Subjects.reduce((res, s) => {
let sName = s.getSubjNameWithoutYear()
@ -1940,7 +1930,8 @@
others: []
})
const ordered = {}
const ordered = {} // FIXME: this shouldt be ordered here.
// subjects should be sorted in 'data', but the active indexes would be incorrect then
Object.keys(grouped).sort().forEach((key) => {
ordered[key] = grouped[key]
})