From fd5813ae28bdbfa13d0fe15e047f12763e8bfafd Mon Sep 17 00:00:00 2001 From: MrFry Date: Sat, 11 Jan 2020 12:51:47 +0100 Subject: [PATCH] Subject index fix --- question-classes | 2 +- stable.user.js | 19 +++++-------------- 2 files changed, 6 insertions(+), 15 deletions(-) diff --git a/question-classes b/question-classes index 100ca77..82c5b21 160000 --- a/question-classes +++ b/question-classes @@ -1 +1 @@ -Subproject commit 100ca7750d88400b227c9e1592300c4d1ea7db5c +Subproject commit 82c5b21c7fd374b9f32887808b6a3d90f545b93e diff --git a/stable.user.js b/stable.user.js index 95239d9..7bd3e17 100644 --- a/stable.user.js +++ b/stable.user.js @@ -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] })