Skip to content

Commit

Permalink
Merge pull request LambdaIITH#9 from iith-dashboard/gpa
Browse files Browse the repository at this point in the history
Show gpa and selected courses in new tab
  • Loading branch information
govindbalaji-s authored Dec 13, 2019
2 parents c8d3af5 + 0f83f34 commit 3ca1deb
Show file tree
Hide file tree
Showing 25 changed files with 226 additions and 28 deletions.
2 changes: 0 additions & 2 deletions firebase-app.js

This file was deleted.

2 changes: 0 additions & 2 deletions firebase-auth.js

This file was deleted.

2 changes: 0 additions & 2 deletions firebase-firestore.js

This file was deleted.

File renamed without changes.
File renamed without changes.
Binary file added fonts/Roboto-Regular.ttf
Binary file not shown.
1 change: 0 additions & 1 deletion google.txt

This file was deleted.

2 changes: 2 additions & 0 deletions js/firebase-app.js

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions js/firebase-auth.js

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions js/firebase-firestore.js

Large diffs are not rendered by default.

File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
"name": "AIMS-Helper",
"version": "0.1",
"background": {
"scripts": ["background.js"],
"scripts": ["/src/bg/background.js"],
"persistent":false
},
"page_action": {
"default_popup":"popup.html "
"default_popup":"/src/popup/popup.html"
},
"content_security_policy":"script-src 'self' https://www.gstatic.com/ https://*.firebaseio.com https://www.googleapis.com https://apis.google.com; object-src 'self'",
"permissions": ["declarativeContent", "storage", "tabs", "<all_urls>","http://*/","https://*/", "identity"],
Expand Down
File renamed without changes
3 changes: 0 additions & 3 deletions slotInfo.json

This file was deleted.

2 changes: 1 addition & 1 deletion background.js → src/bg/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@
function(request, sender)
{
if (request.action == "LaunchTimetableFile")
chrome.tabs.create({ url: chrome.runtime.getURL("table.html") });
chrome.tabs.create({ url: chrome.runtime.getURL("/src/timetable/table.html") });
}
);
26 changes: 22 additions & 4 deletions activateGPA.js → src/gpa/activateGPA.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ Source: https://github.com/IITH/aims-gpa-calculator
*/

var exclude_list = [
'Minor core',
'Honors core',
'Honours project',
'Honours coursework',
'FCC',
Expand Down Expand Up @@ -55,27 +57,43 @@ show_total_gpa = function(){
if ($(".cgpa_cal_check").length==0)
add_checkboxes();
elems = $(".hierarchyLi.dataLi").not(".hierarchyHdr, .hierarchySubHdr");
var type_credits_map = new Map();
elems.each(function(i){
if ($(this).find(".cgpa_cal_check:checked").length == 0 )
return;

var course = new Object();
course.id = $(this).children(".col1").html().trim();
course.code = $(this).children(".col1").contents().filter(function(){
return this.nodeType == Node.TEXT_NODE;
}).text().trim();
course.name = $(this).children(".col2").html().trim();
course.type = $(this).children(".col5").html().trim().slice(6);
course.grade = $(this).children(".col8").html().trim().slice(6);
course.credits = $(this).children(".col3").html().trim().slice(6);
course.credits = Number($(this).children(".col3").html().trim().slice(6));
if (!(course.grade in grade_values))
return;

if (type_credits_map.has(course.type))
type_credits_map.set(course.type, type_credits_map.get(course.type) + course.credits);
else
type_credits_map.set(course.type, course.credits);


grade_value = grade_values[course.grade];
credits = Number(course.credits);
credits = course.credits;
total_grades += credits * grade_value;
total_credits += credits;
courses.push(course);
});
console.log(total_grades, total_credits);
var gpa = (total_grades / total_credits).toFixed(2);
return {courses: courses,
return {
name: $(".stuName").text().trim(),
rollno: $(".studentInfoDiv>.flexDiv:nth-child(3)").find("span").text().trim(),
branch: $(".studentInfoDiv>.flexDiv:nth-child(5)").find("div:nth-child(1)").find("span").text().trim(),
student_type: $(".studentInfoDiv>.flexDiv:nth-child(5)").find("div:nth-child(2)").find("span").text().trim(),
type_credits_map: JSON.stringify(Array.from(type_credits_map)),
courses: JSON.stringify(courses),
gpa: gpa
};
}
Expand Down
Loading

0 comments on commit 3ca1deb

Please sign in to comment.