New database, json filtering and changed up synta;x a bit
This commit is contained in:
168
data/2022prefixes.json
Normal file
168
data/2022prefixes.json
Normal file
@@ -0,0 +1,168 @@
|
|||||||
|
[
|
||||||
|
"AAS",
|
||||||
|
"ACC",
|
||||||
|
"ADV",
|
||||||
|
"AED",
|
||||||
|
"AET",
|
||||||
|
"AFR",
|
||||||
|
"AHC",
|
||||||
|
"ALD",
|
||||||
|
"AMS",
|
||||||
|
"ANS",
|
||||||
|
"ANT",
|
||||||
|
"ARA",
|
||||||
|
"ARC",
|
||||||
|
"ARE",
|
||||||
|
"ARH",
|
||||||
|
"ARI",
|
||||||
|
"ART",
|
||||||
|
"ASE",
|
||||||
|
"ASL",
|
||||||
|
"AST",
|
||||||
|
"B A",
|
||||||
|
"BAX",
|
||||||
|
"BCH",
|
||||||
|
"BDP",
|
||||||
|
"BGS",
|
||||||
|
"BIO",
|
||||||
|
"BME",
|
||||||
|
"C C",
|
||||||
|
"C E",
|
||||||
|
"C S",
|
||||||
|
"CDI",
|
||||||
|
"CH",
|
||||||
|
"CHE",
|
||||||
|
"CHI",
|
||||||
|
"CLD",
|
||||||
|
"CMS",
|
||||||
|
"COE",
|
||||||
|
"COM",
|
||||||
|
"CRP",
|
||||||
|
"CRW",
|
||||||
|
"CSE",
|
||||||
|
"CTI",
|
||||||
|
"D S",
|
||||||
|
"DCH",
|
||||||
|
"DES",
|
||||||
|
"DSC",
|
||||||
|
"E",
|
||||||
|
"E M",
|
||||||
|
"E S",
|
||||||
|
"ECE",
|
||||||
|
"ECO",
|
||||||
|
"EDC",
|
||||||
|
"EDP",
|
||||||
|
"EER",
|
||||||
|
"ELP",
|
||||||
|
"ENM",
|
||||||
|
"ENS",
|
||||||
|
"EUS",
|
||||||
|
"EVE",
|
||||||
|
"EVS",
|
||||||
|
"F A",
|
||||||
|
"FIN",
|
||||||
|
"FR",
|
||||||
|
"GEO",
|
||||||
|
"GER",
|
||||||
|
"GK",
|
||||||
|
"GOV",
|
||||||
|
"GRG",
|
||||||
|
"GSD",
|
||||||
|
"H E",
|
||||||
|
"H S",
|
||||||
|
"HCT",
|
||||||
|
"HDF",
|
||||||
|
"HDO",
|
||||||
|
"HEB",
|
||||||
|
"HED",
|
||||||
|
"HHM",
|
||||||
|
"HIN",
|
||||||
|
"HIS",
|
||||||
|
"HMN",
|
||||||
|
"I",
|
||||||
|
"I B",
|
||||||
|
"ILA",
|
||||||
|
"INF",
|
||||||
|
"IRG",
|
||||||
|
"ISP",
|
||||||
|
"ITD",
|
||||||
|
"ITL",
|
||||||
|
"J",
|
||||||
|
"J S",
|
||||||
|
"JPN",
|
||||||
|
"KIN",
|
||||||
|
"KOR",
|
||||||
|
"L A",
|
||||||
|
"LAH",
|
||||||
|
"LAR",
|
||||||
|
"LAS",
|
||||||
|
"LAT",
|
||||||
|
"LAW",
|
||||||
|
"LEB",
|
||||||
|
"LIN",
|
||||||
|
"M",
|
||||||
|
"M E",
|
||||||
|
"M S",
|
||||||
|
"MAL",
|
||||||
|
"MAN",
|
||||||
|
"MAS",
|
||||||
|
"MEL",
|
||||||
|
"MES",
|
||||||
|
"MIS",
|
||||||
|
"MKT",
|
||||||
|
"MNS",
|
||||||
|
"MOL",
|
||||||
|
"MSE",
|
||||||
|
"MUS",
|
||||||
|
"N",
|
||||||
|
"N S",
|
||||||
|
"NEU",
|
||||||
|
"NOR",
|
||||||
|
"NSC",
|
||||||
|
"NTR",
|
||||||
|
"O M",
|
||||||
|
"ORI",
|
||||||
|
"P A",
|
||||||
|
"P R",
|
||||||
|
"P S",
|
||||||
|
"PBH",
|
||||||
|
"PED",
|
||||||
|
"PGE",
|
||||||
|
"PGS",
|
||||||
|
"PHL",
|
||||||
|
"PHM",
|
||||||
|
"PHY",
|
||||||
|
"POR",
|
||||||
|
"PRC",
|
||||||
|
"PRS",
|
||||||
|
"PSY",
|
||||||
|
"R E",
|
||||||
|
"R M",
|
||||||
|
"R S",
|
||||||
|
"REE",
|
||||||
|
"RHE",
|
||||||
|
"RIM",
|
||||||
|
"RTF",
|
||||||
|
"RUS",
|
||||||
|
"S S",
|
||||||
|
"S W",
|
||||||
|
"SAB",
|
||||||
|
"SDS",
|
||||||
|
"SED",
|
||||||
|
"SLH",
|
||||||
|
"SOC",
|
||||||
|
"SPC",
|
||||||
|
"SPN",
|
||||||
|
"STA",
|
||||||
|
"STC",
|
||||||
|
"SUS",
|
||||||
|
"T C",
|
||||||
|
"T D",
|
||||||
|
"TXA",
|
||||||
|
"U D",
|
||||||
|
"UGS",
|
||||||
|
"URB",
|
||||||
|
"UTL",
|
||||||
|
"UTS",
|
||||||
|
"WGS"
|
||||||
|
]
|
||||||
12
index.html
12
index.html
@@ -37,13 +37,13 @@
|
|||||||
<form action="">
|
<form action="">
|
||||||
|
|
||||||
<!-- Data is separated into course number, course prefi;x, and course name-->
|
<!-- Data is separated into course number, course prefi;x, and course name-->
|
||||||
<label for="courseField">Course Prefix (Ex: "MUS"):</label>
|
<label for="courseField">Department (Ex: "MUS"):</label>
|
||||||
<input type="text" id="courseField" name="fname" required><br><br>
|
<input type="text" id="courseField" name="fname" required><br><br>
|
||||||
<!-- <label for="courseNum">Course Number (Ex: "307"):</label>
|
<label for="courseNum">Course Number (Ex: "307"):</label>
|
||||||
<input type="text" id="courseNum" name="fname"><br><br> -->
|
<input type="text" id="courseNum" name="fname" required><br><br>
|
||||||
<label for="courseName">Course Name (Ex: "Jazz Appreciation"):</label>
|
<label for="courseName">Course Name (Optional, useful for precision Ex: "Jazz Appreciation"):</label>
|
||||||
<input type="text" id="courseName" name="fname" required><br><br>
|
<input type="text" id="courseName" name="fname"><br><br>
|
||||||
<label for="courseInstructor">Instructor (Optional)</label>
|
<label for="courseInstructor">Instructor (Optional):</label>
|
||||||
<input type="text" id="courseInstructor" name="fname"><br><br>
|
<input type="text" id="courseInstructor" name="fname"><br><br>
|
||||||
<button type="button" id="subBut">Submit</button><br><br>
|
<button type="button" id="subBut">Submit</button><br><br>
|
||||||
|
|
||||||
|
|||||||
44
main.js
44
main.js
@@ -11,29 +11,27 @@ const ctx = document.getElementById("gradeBar");
|
|||||||
Parse the name
|
Parse the name
|
||||||
*/
|
*/
|
||||||
function parseName() {
|
function parseName() {
|
||||||
let className = '';
|
let className = document.getElementById('courseName').value;
|
||||||
let classNum = '';
|
let classNum = document.getElementById('courseNum').value;
|
||||||
let department = '';
|
let department = document.getElementById('courseField').value;
|
||||||
className = document.getElementById('courseName').value;
|
if(!className && !classNum && !department) {
|
||||||
// classNum = document.getElementById('courseNum').value;
|
alert("At least fill out the form...");
|
||||||
department = document.getElementById('courseField').value;
|
|
||||||
if(department.length > 3) {
|
|
||||||
alert("Invalid Prefix");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(className == '' && department == '') {
|
if(department.length != 3) {
|
||||||
alert("At least fill out the form...");
|
alert("Invalid Department");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(className == '' || department == '') {
|
if(className == '' || department == '') {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
console.log(department, 0, className);
|
console.log(department, classNum, className);
|
||||||
PapaParse(department, 0, className);
|
PapaParse(department, classNum, className);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function PapaParse(department, num, name) {
|
async function PapaParse(department, num, name) {
|
||||||
let cData = '';
|
let cData = '';
|
||||||
|
// await fetch('https://derec4.github.io/UT-Grade-Dist/2022prefixes.json');
|
||||||
await fetch('https://derec4.github.io/UT-Grade-Dist/2022%20Fall.json')
|
await fetch('https://derec4.github.io/UT-Grade-Dist/2022%20Fall.json')
|
||||||
.then(res => res.json())
|
.then(res => res.json())
|
||||||
.then(data => {
|
.then(data => {
|
||||||
@@ -42,20 +40,24 @@ async function PapaParse(department, num, name) {
|
|||||||
.then(() => {
|
.then(() => {
|
||||||
// console.log(cData);
|
// console.log(cData);
|
||||||
});
|
});
|
||||||
// await fetch('/data/2022 Fall.json')
|
|
||||||
// .then(res => res.json())
|
|
||||||
// .then(data => {
|
|
||||||
// cData = data;
|
|
||||||
// })
|
|
||||||
// .then(() => {
|
|
||||||
// console.log(cData);
|
|
||||||
// });
|
|
||||||
if(cData.filter(cData => cData["Course Prefix"].includes(department.toUpperCase())).length == 0) {
|
if(cData.filter(cData => cData["Course Prefix"].includes(department.toUpperCase())).length == 0) {
|
||||||
alert("Invalid Prefix");
|
alert("Invalid Prefix");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const selectedClass = cData.filter(cData => cData["Course Prefix"].includes(department.toUpperCase()))
|
const selectedClass = '';
|
||||||
|
if(cData.filter(cData => cData["Course Prefix"].includes(department.toUpperCase()))
|
||||||
|
.filter(cData => cData["Course Number"].includes(num.toUpperCase))
|
||||||
|
.filter(cData => cData["Course Title"].includes(name.toUpperCase())).length == 0) {
|
||||||
|
// Possible that the class name was typed wrong; try again with just the course number
|
||||||
|
selectedClass = cData.filter(cData => cData["Course Prefix"].includes(department.toUpperCase()))
|
||||||
.filter(cData => cData["Course Title"].includes(name.toUpperCase()));
|
.filter(cData => cData["Course Title"].includes(name.toUpperCase()));
|
||||||
|
} else {
|
||||||
|
selectedClass = cData.filter(cData => cData["Course Prefix"].includes(department.toUpperCase()))
|
||||||
|
.filter(cData => cData["Course Number"].includes(num.toUpperCase))
|
||||||
|
.filter(cData => cData["Course Title"].includes(name.toUpperCase()))
|
||||||
|
}
|
||||||
|
|
||||||
console.log(selectedClass);
|
console.log(selectedClass);
|
||||||
let gradeDist = {
|
let gradeDist = {
|
||||||
"A": 0,
|
"A": 0,
|
||||||
|
|||||||
Reference in New Issue
Block a user