added semesters column to db

This commit is contained in:
Sriram Hariharan
2018-12-30 15:40:36 -06:00
parent 1b50d2d5a9
commit 1a7d334cf5
3 changed files with 63 additions and 11 deletions

BIN
grades.db

Binary file not shown.

View File

@@ -35,7 +35,36 @@ $(function () {
//make heading and modal
if (!$("#kw_results_table").length) {
$("table thead th:last-child").after('<th scope=col>Plus</th>');
var modhtml = '<div class=modal id=myModal><div class=modal-content><span class=close>×</span><div class=card><div class=cardcontainer><h2 class=title id="title">Computer Fluency (C S 302)</h2><h2 class=profname id="profname">with Bruce Porter</h2><div id="topbuttons" class=topbuttons><button class=matbut id="rateMyProf" style="background: #4CAF50;"> RMP </button><button class=matbut id="eCIS" style="background: #CDDC39;"> eCIS </button><button class=matbut id="textbook" style="background: #FFC107;"> Textbook </button><button class=matbut id="Syllabi"> Past Syllabi </button><button class=matbut id="saveCourse" style="background: #F44336;"> Save Course +</button></div></div></div><div class=card><div class=cardcontainer style=""><ul class=description id="description" style="list-style-type:disc"></ul></div></div><div class=card ><div id="chartcontainer" class=cardcontainer><div id=chart></div></div></div>';
var modhtml = `<div class=modal id=myModal>
<div class=modal-content>
<span class=close>×</span>
<div class=card>
<div class=cardcontainer>
<h2 class=title id="title">Computer Fluency (C S 302)</h2>
<h2 class=profname id="profname">with Bruce Porter</h2>
<div id="topbuttons" class=topbuttons>
<button class=matbut id="rateMyProf" style="background: #4CAF50;"> RMP </button>
<button class=matbut id="eCIS" style="background: #CDDC39;"> eCIS </button>
<button class=matbut id="textbook" style="background: #FFC107;"> Textbook </button>
<button class=matbut id="Syllabi"> Past Syllabi </button>
<button class=matbut id="saveCourse" style="background: #F44336;"> Save Course +</button>
</div>
</div>
</div>
<div class=card>
<div class=cardcontainer style="">
<ul class=description id="description" style="list-style-type:disc"></ul>
</div>
</div>
<div class=card >
<select id="semesters">
</select>
<div id="chartcontainer" class=cardcontainer>
<div id=chart></div>
</div>
</div>
</div>
</div>`;
$("#container").prepend(modhtml);
$("#myModal").prepend("<div id='snackbar'>defaultmessage..</div>");
//go through all the rows in the list
@@ -105,7 +134,12 @@ function loadNextPages(inHTML){
if (next.length) {
let link = next.prop('href');
console.log(link);
chrome.runtime.sendMessage({method: "GET", action: "xhttp", url:link, data:""}, function(response){
chrome.runtime.sendMessage({
method: "GET",
action: "xhttp",
url: link,
data: ""
}, function (response) {
if (response) {
var nextpage = $('<div/>').html(response).contents();
var current = $('tbody');
@@ -322,6 +356,8 @@ function getDistribution() {
function openDialog(dep, cls, sem, professor, res) {
$("#myModal").fadeIn(fadetime);
//initial text on the "save course button"
chrome.runtime.sendMessage({
command: "alreadyContains",
unique: uniquenum
@@ -334,9 +370,16 @@ function openDialog(dep, cls, sem, professor, res) {
});
//set if no grade distribution
var data;
$("#semesters").empty();
if (typeof res == 'undefined' || profname == "") {
data = [];
$("#semesters").append("<option>No Data</option>")
} else {
var semesters = res.values[0][18].split(",");
semesters.unshift('Aggregate');
for (var i = 0; i < semesters.length; i++) {
$("#semesters").append(`<option>${semesters[i]}</option>`)
}
data = res.values[0];
}
var modal = document.getElementById('myModal');

9
todo
View File

@@ -27,3 +27,12 @@ DONE/FIXED:
- Showing the icon on the flags pages
- Easter egg, no course messages
- search by unique number
for FIXING DB:
ALTER TABLE agg ADD semesters
update agg
set semesters = (select group_concat(sem) from grades where agg.prof = grades.prof and agg.course_nbr = grades.course_nbr and agg.dept = grades.dept);