mirror of
https://gitlab.com/MrFry/moodle-test-userscript
synced 2025-04-01 20:22:48 +02:00
Subject index fix
This commit is contained in:
parent
1e1a179e80
commit
fd5813ae28
2 changed files with 6 additions and 15 deletions
|
@ -1 +1 @@
|
||||||
Subproject commit 100ca7750d88400b227c9e1592300c4d1ea7db5c
|
Subproject commit 82c5b21c7fd374b9f32887808b6a3d90f545b93e
|
|
@ -254,6 +254,7 @@
|
||||||
constructor (q, a, i) {
|
constructor (q, a, i) {
|
||||||
this.Q = SUtils.SimplifyQuestion(q)
|
this.Q = SUtils.SimplifyQuestion(q)
|
||||||
this.A = SUtils.SimplifyAnswer(a)
|
this.A = SUtils.SimplifyAnswer(a)
|
||||||
|
// TODO: sorting breaks image order
|
||||||
try {
|
try {
|
||||||
this.I = JSON.parse(i).sort((a, b) => {
|
this.I = JSON.parse(i).sort((a, b) => {
|
||||||
return a.localeCompare(b)
|
return a.localeCompare(b)
|
||||||
|
@ -328,7 +329,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
getIndex () {
|
getIndex () {
|
||||||
return this.index || -1
|
return this.index
|
||||||
}
|
}
|
||||||
|
|
||||||
get length () {
|
get length () {
|
||||||
|
@ -777,8 +778,7 @@
|
||||||
// "húzza oda ..." skip
|
// "húzza oda ..." skip
|
||||||
fun.push((i) => {
|
fun.push((i) => {
|
||||||
let temp = RPM.GetAnswersFromGrabBox(i)
|
let temp = RPM.GetAnswersFromGrabBox(i)
|
||||||
console.log('GRABBOX TEST') // TODO: remove
|
console.log('GRABBOX TEST', temp) // TODO: remove
|
||||||
console.log(temp)
|
|
||||||
return temp.map((x) => {
|
return temp.map((x) => {
|
||||||
return x.text
|
return x.text
|
||||||
}).join(', ')
|
}).join(', ')
|
||||||
|
@ -1914,16 +1914,6 @@
|
||||||
subjTable.style.textAlign = 'left'
|
subjTable.style.textAlign = 'left'
|
||||||
subjTable.style.width = '98%'
|
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) {
|
if (data && data.length > 0) {
|
||||||
let grouped = data.Subjects.reduce((res, s) => {
|
let grouped = data.Subjects.reduce((res, s) => {
|
||||||
let sName = s.getSubjNameWithoutYear()
|
let sName = s.getSubjNameWithoutYear()
|
||||||
|
@ -1940,7 +1930,8 @@
|
||||||
others: []
|
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) => {
|
Object.keys(grouped).sort().forEach((key) => {
|
||||||
ordered[key] = grouped[key]
|
ordered[key] = grouped[key]
|
||||||
})
|
})
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue