// ===== v32 - PUT TOGETHER - REAL QUESTIONS ONLY =====
function getAllQuestions(){
let all = [];
try{ all = all.concat(getJSS1English()); }catch(e){}
try{ all = all.concat(getJSS1Maths()); }catch(e){}
try{ all = all.concat(getJSS1BasicScience()); }catch(e){}
try{ all = all.concat(getJSS1BasicTech()); }catch(e){}
try{ all = all.concat(getJSS2BasicScience()); }catch(e){}
try{ all = all.concat(getJSS3BasicScience()); }catch(e){}
try{ all = all.concat(getJSS3BasicTech()); }catch(e){}
return all;
}
let Q_BANK = getAllQuestions();
let S = DEFAULT_SUBS;
// ===== STUDENT EXAM =====
let curClass="", curSub="", curQs=[], curIdx=0, curAns=[], startTime=null;
function studentView(name){
document.getElementById('welcome').innerHTML = "Welcome "+name+" First Term Exam";
document.getElementById('content').innerHTML = `
1. Select Your Class
${CLASSES.map(c=>`
${c}
`).join('')}
2. Select Subject
`;
}
function pickClass(c,el){
curClass=c;
document.querySelectorAll('.cls').forEach(x=>x.classList.remove('sel'));
el.classList.add('sel');
}
function startExam(){
curSub=document.getElementById('subSel').value;
if(!curClass){ alert("Select Class first"); return; }
if(!curSub){ alert("Select Subject"); return; }
// Filter ONLY real questions for that class + subject
curQs = Q_BANK.filter(q=>q.cls===curClass && q.sub.toLowerCase()===curSub.toLowerCase());
if(curQs.length===0){ alert("No real questions yet for "+curClass+" "+curSub); return; }
curQs = mixAnswers(curQs); // shuffle options
curIdx=0; curAns=new Array(curQs.length).fill(-1);
showQ();
}
function showQ(){
let q=curQs[curIdx];
let timeLeft = curSub==="Mathematics" ? 50*60 : 30*60;
document.getElementById('content').innerHTML = `