Skip to content

Commit 168e0f9

Browse files
authored
Merge pull request #130 from devinmatte/master
Adding Start Time to event Card
2 parents 0bee408 + d01bdcc commit 168e0f9

File tree

2 files changed

+27
-4
lines changed

2 files changed

+27
-4
lines changed

assets/src/modules/sm/Schedule/directives/scheduleDirective.js

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,9 +133,32 @@ angular.module('sm').directive('schedule', function($timeout, $filter) {
133133
timeTop = Math.floor(timeTop);
134134
timeTop = timeTop * 5;
135135
timeTop += 19; // Offset for the header
136-
137-
if(course.courseNum != 'non') {
138-
var location = ((this.drawOptions.bldgStyle == 'code') ? time.bldg.code : time.bldg.number) + "-" + time.room,
136+
137+
//Add Padding for Formatting Time
138+
function pad(d) {
139+
//Allows for time to display as example: 12:04 instead of 12:4
140+
return (d < 10) ? '0' + d.toString() : d.toString();
141+
}
142+
143+
//Format Start time
144+
var hourLabel = Math.floor(courseStart / 60);
145+
if(hourLabel > 12) {
146+
hourLabel -= 12;
147+
}
148+
else if(hourLabel == 0) {
149+
hourLabel = 12;
150+
}
151+
var minuteLabel = (courseStart % 60);
152+
minuteLabel = pad(minuteLabel);
153+
if(courseStart >= 720) {
154+
ap = " PM";
155+
} else {
156+
ap = " AM";
157+
}
158+
159+
//Set event data
160+
if(course.courseNum != 'non') {
161+
var location = ((this.drawOptions.bldgStyle == 'code') ? time.bldg.code : time.bldg.number) + "-" + time.room + " (" + (String(hourLabel) + ":" + String(minuteLabel) + " " + ap) + ")",
139162
instructor = course.instructor,
140163
courseNum = course.courseNum;
141164
} else {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "schedulemaker",
3-
"version": "3.0.27",
3+
"version": "3.0.28",
44
"private": true,
55
"description": "A course database lookup tool and schedule building web application for use at Rochester Institute of Technology.",
66
"main": "index.php",

0 commit comments

Comments
 (0)