calendar hours and num courses count

This commit is contained in:
Sriram Hariharan
2019-01-12 00:21:41 -06:00
parent 5b1641255d
commit 3adbb95744
3 changed files with 14 additions and 4 deletions

View File

@@ -11,15 +11,19 @@
<body>
<div style='display:flex'>
<div id='calendar' style="flex-grow: 1"></div>
<div class="card" id="header" style="text-align:center;margin:5px 0px 0px 15px;">
<h1 style="font-weight:500">Schedule</h1>
<div class="card" id="header" style="text-align:center;margin:5px 0px 0px 15px;display: inline-table;padding-bottom: 5px;">
<h1 id='hours' style="font-size:30px;font-weight:500; border-bottom: 3px solid black;display: inline-block;padding-bottom: 5px;margin-bottom: 5px;">0
hours</h1>
<h1 id='num' style="font-size:20px;font-weight:500; margin: 2px;">0
Courses</h1>
<br>
<div style="margin:5px;display: flex;flex-direction: column;">
<button id="clear" class="matbut" style="font-size:medium; background:#4CAF50;margin: 10px;white-space: nowrap;text-align: center;">Clear
All</button>
<button id="save" class="matbut" style="font-size:medium; background:#FF9800;margin: 10px;white-space: nowrap;text-align: center;">Save
as PNG</button>
<button id="export" class="matbut" style="font-size:medium; background:#FF0000;margin: 10px;white-space: nowrap;text-align: center;">Export
to ICS</button>
Cal</button>
</div>
</div>
</div>

View File

@@ -241,13 +241,19 @@ $(function () {
function setAllEvents(savedCourses) {
colorCounter = 0;
classSchedules = [];
var hours = 0;
for (let i = 0; i < savedCourses.length; i++) {
var classInfo = savedCourses[i];
var course_nbr = classInfo.coursename.substring(classInfo.coursename.search(/\d/), classInfo.coursename.indexOf(" ", classInfo.coursename.search(/\d/)));
hours += parseInt(course_nbr.substring(course_nbr.search(/\d/), course_nbr.search(/\d/) + 1));
for (let j = 0; j < savedCourses[i].datetimearr.length; j++) {
let session = savedCourses[i].datetimearr[j]; // One single session for a class
setEventForSection(session, colorCounter, i);
}
colorCounter++;
}
$("#hours").text(hours + " Hours");
$("#num").text(savedCourses.length + " Courses");
}
//create the event object for every section

View File

@@ -439,7 +439,7 @@ function getDistribution(sem) {
/*Open the modal and show all the data*/
function openDialog(dep, cls, sem, professor, res) {
$("#myModal").fadeIn(100);
$("#myModal").fadeIn(fadetime);
//initial text on the "save course button"