-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathadmin.mjs
34 lines (27 loc) · 1018 Bytes
/
admin.mjs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
window.TESTING = window.location.hostname === '127.0.0.1';
window.clearCache = () => {
for (let item in localStorage) if (item.includes('https')) localStorage.removeItem(item);
}
window.switchStudent = username => {
const github = JSON.parse(localStorage.getItem('github')) || {};
if (github.login) {
github.login = username;
localStorage.setItem('github', JSON.stringify(github));
window.location.reload();
}
}
window.getStudents = async () => {
const students = await getData('students');
const year = await getYear();
const github = await getGitHub();
const term = getTerm(github);
const Students = [];
for (let student in students) {
if (students[student].cohorts.some(cohort => cohort.year === year && cohort.system === term[1] && cohort.season === term[2]))
Students.push(student);
}
console.info(Students);
}
String.prototype.capitalize = function() {
return this.charAt(0).toUpperCase() + this.slice(1);
};