Experimental feature bye bye

This commit is contained in:
2023-06-07 10:36:11 +08:00
parent 335547cb6a
commit 335a644608
2 changed files with 7 additions and 4 deletions

View File

@@ -54,8 +54,8 @@
<input type="text" id="courseNum" name="fname" required><br><br> <input type="text" id="courseNum" name="fname" required><br><br>
<label for="courseName">Course Name (Optional, useful for same-number classes Ex: UGS 303):</label> <label for="courseName">Course Name (Optional, useful for same-number classes Ex: UGS 303):</label>
<input type="text" id="courseName" name="fname"><br><br> <input type="text" id="courseName" name="fname"><br><br>
<label for="sectionNum">Section Number (Optional, Experimental)</label> <!-- <label for="sectionNum">Section Number (Optional, Experimental)</label>
<input type="text" id="sectionNum" name="fname" required><br><br> <input type="text" id="sectionNum" name="fname" required><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>

View File

@@ -1,5 +1,4 @@
const submitButton = document.getElementById('subBut'); const submitButton = document.getElementById('subBut');
submitButton.addEventListener("click", parseName);
const chartDiv = document.querySelector('#grades'); const chartDiv = document.querySelector('#grades');
const aboutDiv = document.querySelector('.about-text'); const aboutDiv = document.querySelector('.about-text');
const formDiv = document.querySelector('.bg-form'); const formDiv = document.querySelector('.bg-form');
@@ -10,6 +9,8 @@ var gradeChart;
const ctx = document.getElementById("gradeBar"); const ctx = document.getElementById("gradeBar");
const gradeLabels = ["A", "A-", "B+", "B", "B-", "C+", "C", "C-", "D+", "D", "D-", "F"]; const gradeLabels = ["A", "A-", "B+", "B", "B-", "C+", "C", "C-", "D+", "D", "D-", "F"];
const backgroundColor = ["rgb(98, 244, 54)", "rgb(129, 231, 10)", "rgb(151, 218, 0)", "rgb(168, 204, 0)", "rgb(181, 190, 0)", "rgb(191, 176, 0)", "rgb(199, 162, 0)", "rgb(205, 148, 0)", "rgb(209, 133, 0)", "rgb(211, 119, 0)", "rgb(210, 105, 0)", "rgb(208, 91, 23)", "rgb(204, 78, 36)", "rgb(198, 66, 46)", "rgb(190, 54, 54)", ""]; const backgroundColor = ["rgb(98, 244, 54)", "rgb(129, 231, 10)", "rgb(151, 218, 0)", "rgb(168, 204, 0)", "rgb(181, 190, 0)", "rgb(191, 176, 0)", "rgb(199, 162, 0)", "rgb(205, 148, 0)", "rgb(209, 133, 0)", "rgb(211, 119, 0)", "rgb(210, 105, 0)", "rgb(208, 91, 23)", "rgb(204, 78, 36)", "rgb(198, 66, 46)", "rgb(190, 54, 54)", ""];
submitButton.addEventListener("click", parseName);
/* /*
Parse the input form and class data Parse the input form and class data
*/ */
@@ -96,6 +97,7 @@ async function PapaParse(department, num, name, sem, unique) {
.filter(cData => cData["Course Number"].includes(num.toString().toUpperCase())) .filter(cData => cData["Course Number"].includes(num.toString().toUpperCase()))
.filter(cData => cData["Course Title"].includes(name)); .filter(cData => cData["Course Title"].includes(name));
if (selectedClass.length == 0) { if (selectedClass.length == 0) {
// summer names are weird // summer names are weird
console.log("Invalid name; trying again with just the course number"); console.log("Invalid name; trying again with just the course number");
selectedClass = cData.filter(cData => cData["Course Prefix"] == department) selectedClass = cData.filter(cData => cData["Course Prefix"] == department)
@@ -106,6 +108,7 @@ async function PapaParse(department, num, name, sem, unique) {
.filter(cData => cData["Course Number"] == num.toString().toUpperCase()) .filter(cData => cData["Course Number"] == num.toString().toUpperCase())
.filter(cData => cData["Course Title"].includes(name)); .filter(cData => cData["Course Title"].includes(name));
if (selectedClass.length == 0) { if (selectedClass.length == 0) {
// Possible that the class name was typed wrong; try again with just the course number // Possible that the class name was typed wrong; try again with just the course number
console.log("Invalid name; trying again with just the course number"); console.log("Invalid name; trying again with just the course number");
selectedClass = cData.filter(cData => cData["Course Prefix"] == department) selectedClass = cData.filter(cData => cData["Course Prefix"] == department)
@@ -114,6 +117,7 @@ async function PapaParse(department, num, name, sem, unique) {
} }
} }
if (selectedClass.length == 0) { if (selectedClass.length == 0) {
// Still can't find anything? Just exit without making a chart and alert that nothing could be found // Still can't find anything? Just exit without making a chart and alert that nothing could be found
alert("No data found. Try again :("); alert("No data found. Try again :(");
return; return;
@@ -157,7 +161,6 @@ async function PapaParse(department, num, name, sem, unique) {
label: '\"' + lableName + "\"", label: '\"' + lableName + "\"",
data: Object.values(gradeDist), data: Object.values(gradeDist),
borderWidth: 2, borderWidth: 2,
// borderColor: '#36A2EB',
backgroundColor: backgroundColor, backgroundColor: backgroundColor,
}] }]
}; };