mirror of
https://github.com/BetterSEQTA/BetterSEQTA-Plus.git
synced 2026-06-06 11:44:40 +00:00
fix(studentInfo): some cases year may be undefined
This commit is contained in:
@@ -13,7 +13,11 @@ export async function AddBetterSEQTAElements() {
|
|||||||
document.documentElement.classList.add('dark');
|
document.documentElement.classList.add('dark');
|
||||||
}
|
}
|
||||||
createHomeButton();
|
createHomeButton();
|
||||||
|
try {
|
||||||
await appendBackgroundToUI();
|
await appendBackgroundToUI();
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Error appending background to UI:', error);
|
||||||
|
}
|
||||||
await handleUserInfo();
|
await handleUserInfo();
|
||||||
handleStudentData();
|
handleStudentData();
|
||||||
createNewsButton();
|
createNewsButton();
|
||||||
@@ -144,7 +148,7 @@ async function getUserInfo() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function updateStudentInfo(students: any) {
|
async function updateStudentInfo(students: any) {
|
||||||
const info = await getUserInfo(); // You would need to implement this to fetch or pass the user info
|
const info = await getUserInfo();
|
||||||
var index = students.findIndex(function (person: any) {
|
var index = students.findIndex(function (person: any) {
|
||||||
return (
|
return (
|
||||||
person.firstname == info.userDesc.split(' ')[0] &&
|
person.firstname == info.userDesc.split(' ')[0] &&
|
||||||
@@ -167,7 +171,11 @@ async function updateStudentInfo(students: any) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
try {
|
||||||
houseelement.innerText = students[index].year;
|
houseelement.innerText = students[index].year;
|
||||||
|
} catch(err) {
|
||||||
|
houseelement.innerText = 'N/A';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user