Skip to content

Commit 0578647

Browse files
committed
Fixes #44 by adding credit support everywhere.
Fixes #14, made class heights snap to 15-minute blocks. Fixes #72 by adding a simple responsive table wrapper, along with a potential iPhone weekView fix for schedules.
1 parent 74d6861 commit 0578647

File tree

10 files changed

+44
-15
lines changed

10 files changed

+44
-15
lines changed

assets/src/modules/sm/App/controllers/AppController.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ angular.module('sm').controller("AppController", function($scope, localStorage,
2323
$scope.state.displayOptions = {
2424
currentPage: 0,
2525
pageSize: 3,
26+
creditWarning: 18,
2627
fullscreen: ''
2728
};
2829

@@ -72,6 +73,10 @@ angular.module('sm').controller("AppController", function($scope, localStorage,
7273
// Check if state version exists or is correct
7374
if(storedState.hasOwnProperty('meta') && storedState.meta.stateVersion == $scope.stateVersion) {
7475
$scope.state = storedState;
76+
console.log('asdjasdjk');
77+
if(!$scope.state.displayOptions.hasOwnProperty('creditWarning') || !$scope.state.displayOptions.creditWarning) {
78+
$scope.state.displayOptions.creditWarning = 18;
79+
}
7580
} else {
7681

7782
// Before state meta

assets/src/modules/sm/App/directives/courseDetailPopover.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ angular.module('sm').directive('courseDetailPopover', function($http, $filter) {
5757
trigger:'click',
5858

5959
title: data.courseNum,
60-
content: '<div class="well-sm pull-right" style=" background-color: #ddd;" title="Other students enrolled as of 6AM today">' + data.curenroll + '/' + data.maxenroll + ' <i class="fa fa-user"></i></div><p>' + data.title + '<br><span class="label label-default popover-white">' + RMPUrl(data.instructor) + '</span></p><p>' + getTimesHTML(data.times) + '</p><p>' + data.description + '</p>',
60+
content: '<div class="well-sm pull-right" style=" background-color: #ddd;" title="Other students enrolled as of 6AM today">' + data.curenroll + '/' + data.maxenroll + ' <i class="fa fa-user"></i></div><p>' + data.title + ' - ' + data.credits + ' credits<br><span class="label label-default popover-white">' + RMPUrl(data.instructor) + '</span></p><p>' + getTimesHTML(data.times) + '</p><p>' + data.description + '</p>',
6161
container: '#container'
6262
});
6363
elm.popover('show');

assets/src/modules/sm/App/styles/global.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -650,6 +650,7 @@ svg g.item:hover rect {
650650
.schedule-track.mobileWeek svg {
651651
width: 1000px;
652652
transform: scale(.25);
653+
-webkit-transform: scale(.25);
653654
position: relative;
654655
left: -366px;
655656
margin-bottom: -400px;

assets/src/modules/sm/Generate/templates/generate.html

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -267,18 +267,18 @@ <h3 class="panel-title">Mobile Display</h3>
267267
<div class="panel panel-default">
268268
<div class="panel-heading panel-heading-controls">
269269
<div class="row form-horizontal">
270-
<div class="col-md-3">
270+
<div class="col-md-2">
271271
<div class="form-group">
272-
<label for="options-bldgStyle" class="col-sm-4 control-label">Buildings:</label>
273-
<div class="col-sm-8">
272+
<label for="options-bldgStyle" class="col-sm-6 control-label">Buildings:</label>
273+
<div class="col-sm-6">
274274
<select id="options-bldgStyle" class="form-control" ng-model="state.drawOptions.bldgStyle">
275275
<option value="code">Codes (eg. GOL)</option>
276276
<option value="number">Number (eg. 70)</option>
277277
</select>
278278
</div>
279279
</div>
280280
</div>
281-
<div class="col-md-3">
281+
<div class="col-md-2">
282282
<div class="form-group hidden-xs">
283283
<label for="options-fullscreen" class="col-sm-4 control-label">Width:</label>
284284
<div class="col-sm-8">
@@ -304,6 +304,14 @@ <h3 class="panel-title">Mobile Display</h3>
304304
</div>
305305
</div>
306306
</div>
307+
<div class="col-md-2">
308+
<div class="form-group">
309+
<label for="displayOptions-creditWarning" class="col-sm-6 control-label">Credits:</label>
310+
<div class="col-sm-6">
311+
<input ng-pattern="/^\d{1,2}$/" type="text" id="displayOptions-creditWarning" class="form-control" ng-model="state.displayOptions.creditWarning" />
312+
</div>
313+
</div>
314+
</div>
307315
<div class="col-md-3">
308316
<div class="pull-right" pagination-controls="state.displayOptions" pagination-length="state.schedules.length" pagination-callback="scrollToSchedules()"></div>
309317
</div>

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

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ angular.module('sm').directive('schedule', function($timeout, $filter) {
1414
this.scope.hiddenCourses = [];
1515
this.scope.onlineCourses = [];
1616
this.scope.scheduleItems = [];
17+
this.scope.totalCredits = 10;
1718

1819
return true;
1920
};
@@ -121,9 +122,10 @@ angular.module('sm').directive('schedule', function($timeout, $filter) {
121122

122123
// Calculate the height
123124
var timeHeight = parseInt(courseEnd) - parseInt(courseStart);
124-
timeHeight = timeHeight / 30;
125+
timeHeight = timeHeight / 15;
125126
timeHeight = Math.ceil(timeHeight);
126-
timeHeight = (timeHeight * 20);
127+
128+
timeHeight = (timeHeight * 10);
127129

128130
// Calculate the top offset
129131
var timeTop = parseInt(courseStart) - startTime;
@@ -163,6 +165,7 @@ angular.module('sm').directive('schedule', function($timeout, $filter) {
163165

164166
Schedule.prototype.drawCourses = function() {
165167
this.courseDrawIndex = 0;
168+
this.scope.totalCredits = 0;
166169
for(var coursesIndex = 0, coursesLength = this.scope.schedule.length; coursesIndex < coursesLength; coursesIndex++) {
167170
var course = this.scope.schedule[coursesIndex];
168171
this.courseDrawIndex++;
@@ -171,6 +174,8 @@ angular.module('sm').directive('schedule', function($timeout, $filter) {
171174
} else if(course.times != undefined) {
172175
this.drawCourse(course);
173176
}
177+
//console.log(course);
178+
this.scope.totalCredits+= (course.hasOwnProperty('credits')? +course.credits: 0);
174179
}
175180
};
176181

assets/src/modules/sm/Schedule/templates/scheduleitem.html

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,13 @@ <h2 class="panel-title control-label pull-left smaller-sm">{{saveAction == "crea
7070
<svg version="1.1" ng-attr-height="{{grid.opts.height}}" width="100%" xmlns="http://www.w3.org/2000/svg"><defs><pattern vector-effect="non-scaling-stroke" id="day" width="100%" x="0" height="40" patternUnits="userSpaceOnUse"><line vector-effect="non-scaling-stroke" x1="0" y1="19.5" x2="100%" y2="19.5" style="stroke:#bbb;stroke-width:1" /></pattern></defs><rect x="0" y="0" width="100%" height="100%" fill="#ffffff" /><g ng-attr-transform="{{grid.opts.pixelAlignment}}" font-family="Roboto" font-size="15"><g class="svg-schedule-hours"><text fill="#aaa" text-anchor="end" ng-repeat="hour in grid.hours track by $index" ng-attr-x="{{print?'41':'5%'}}" ng-attr-y="{{($index * 40) + 25}}">{{hour}}</text></g><g ng-repeat="day in grid.days"><text y="12" ng-attr-x="{{day.offset}}" ng-attr-width="{{grid.opts.daysWidth}}" fill="#aaa" ng-bind="day.name"></text><rect y="19" ng-attr-x="{{day.offset}}" ng-attr-width="{{grid.opts.daysWidth}}" ng-attr-height="{{grid.opts.daysHeight}}" fill="url(#day)" /></g><g svg-schedule-item class="item" ng-mouseenter="itemEnter($event)" ng-mouseleave="itemLeave($event)" ng-repeat="item in scheduleItems | orderBy:'-boundry.y'"><rect ng-attr-x="{{item.boundry.x}}" ng-attr-y="{{item.boundry.y}}" ng-attr-width="{{item.boundry.width}}" ng-attr-height="{{item.boundry.height}}" ng-attr-fill="{{item.color}}" fill-opacity=".8" /><rect ng-if="item.boundry.shorten != 0" ng-attr-x="{{item.boundry.x}}" ng-attr-y="{{item.boundry.shorten < 0 ?item.boundry.y : item.boundry.y + item.boundry.height - 2}}" ng-attr-width="{{item.boundry.width}}" height="2" fill="#ffff00" /><text svg-text-line="{{item.title}}" ng-attr-x="{{item.boundry.x}}" ng-attr-y="{{item.boundry.y + 16}}" transform="translate(3,0)" font-weight="bold" fill="white"></text><text ng-if="item.boundry.height > 32 && item.content.courseNum" svg-text-line="{{item.content.courseNum}}" ng-attr-x="{{item.boundry.x}}" ng-attr-y="{{item.boundry.y + 32}}" transform="translate(3,0)" fill="#fff"></text><text ng-if="item.boundry.height > 48 && item.content.instructor" svg-text-line="{{item.content.instructor}}" ng-attr-x="{{item.boundry.x}}" ng-attr-y="{{item.boundry.y + 48}}" transform="translate(3,0)" fill="#fff"></text><text ng-if="item.boundry.height > 64 && item.content.location" svg-text-line="{{item.content.location}}" ng-attr-x="{{item.boundry.x}}" ng-attr-y="{{item.boundry.y + 64}}" transform="translate(3,0)" fill="#fff"></text><g svg-text-content="item.content"></g></g></g></svg>
7171
</div>
7272
</div>
73+
<div ng-if="totalCredits > state.displayOptions.creditWarning" class="row">
74+
<div class="col-xs-12">
75+
<div class="alert alert-warning">
76+
<strong>Warning!</strong> This schedule contains {{totalCredits}} credits, which is {{state.displayOptions.creditWarning - totalCredits}} over the limit. You can adjust the limit by changing the number of max credits at the bottom.
77+
</div>
78+
</div>
79+
</div>
7380
<div ng-if="hiddenCourses.length > 0" class="row">
7481
<div class="col-xs-12">
7582
<div class="alert alert-warning">

assets/src/modules/sm/Status/templates/status.html

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
<div class="container">
22
<div class="panel panel-default">
3-
<div class="panel-heading">
3+
<div class="panel-heading clearfix">
44
<h3 class="panel-title">Last 20 Data Scrapes <div class="pull-right">Last run: {{logs.length > 0?timeConvert(logs[0].timeStarted):'Never'}}</div></h3>
55
</div>
66
<div class="panel-body">
7+
<div class="table-responsive">
78
<table class="table">
89
<thead>
910
<tr>
@@ -31,6 +32,7 @@ <h3 class="panel-title">Last 20 Data Scrapes <div class="pull-right">Last run: {
3132
</tr>
3233
</tbody>
3334
</table>
35+
</div>
3436
</div>
3537
</div>
3638
</div>

inc/databaseConn.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ function getMeetingInfo($sectionData) {
4444
"courseParentNum" => "{$sectionData['department']}-{$sectionData['course']}",
4545
"courseId" => $sectionData['courseId'],
4646
"id" => $sectionData['id'],
47-
"online" => $sectionData['type'] == "O"
47+
"online" => $sectionData['type'] == "O",
48+
"credits" => $sectionData['credits']
4849
);
4950

5051
if(isset($sectionData['description'])) {
@@ -96,7 +97,7 @@ function getCourseBySectionId($id, $withDescription = false) {
9697
$query = "SELECT s.id,
9798
(CASE WHEN (s.title != '') THEN s.title ELSE c.title END) AS title,
9899
c.id AS courseId,
99-
s.instructor, s.curenroll, s.maxenroll, s.type, c.quarter, c.course{$descriptionSQL}, s.section, d.number, d.code
100+
s.instructor, s.curenroll, s.maxenroll, s.type, c.quarter, c.credits, c.course{$descriptionSQL}, s.section, d.number, d.code
100101
FROM sections AS s
101102
JOIN courses AS c ON s.course = c.id
102103
JOIN departments AS d ON d.id = c.department
@@ -133,7 +134,7 @@ function getCourse($term, $dept, $courseNum, $sectNum) {
133134
if($term > 20130) {
134135
$query = "SELECT s.id,
135136
(CASE WHEN (s.title != '') THEN s.title ELSE c.title END) AS title,
136-
s.instructor, s.curenroll, s.maxenroll, s.type, d.code AS department, c.course, s.section
137+
s.instructor, s.curenroll, s.maxenroll, s.type, d.code AS department, c.course, c.credits, s.section
137138
FROM sections AS s
138139
JOIN courses AS c ON c.id=s.course
139140
JOIN departments AS d ON d.id=c.department
@@ -143,7 +144,7 @@ function getCourse($term, $dept, $courseNum, $sectNum) {
143144
} else {
144145
$query = "SELECT s.id,
145146
(CASE WHEN (s.title != '') THEN s.title ELSE c.title END) AS title,
146-
s.instructor, s.curenroll, s.maxenroll, s.type, d.number AS department, c.course, s.section
147+
s.instructor, s.curenroll, s.maxenroll, s.type, d.number AS department, c.course, c.credits, s.section
147148
FROM sections AS s
148149
JOIN courses AS c ON c.id=s.course
149150
JOIN departments AS d ON d.id=c.department

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.14",
3+
"version": "3.0.15",
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",

tools/processDump.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -523,7 +523,7 @@ function procInstrArray($lineSplit) {
523523
$departmentsProc = mysqli_affected_rows($dbConn);
524524

525525
// Grab each COURSE from the classes table
526-
$courseQuery = "SELECT strm, subject, acad_org, catalog_nbr, descr, course_descrlong,";
526+
$courseQuery = "SELECT strm, subject, units, acad_org, catalog_nbr, descr, course_descrlong,";
527527
$courseQuery .= " crse_id, crse_offer_nbr, session_code";
528528
$courseQuery .= " FROM classes WHERE strm < 20130 GROUP BY crse_id, strm, session_code";
529529
debug("... Updating courses\n0%", false);
@@ -556,7 +556,7 @@ function procInstrArray($lineSplit) {
556556

557557
// Insert or update the course
558558
$courseId = insertOrUpdateCourse($row['qtr'], $row['subject'], $row['acad_org'], $row['catalog_nbr'],
559-
0, $row['descr'], $row['course_descrlong']);
559+
$row['units'], $row['descr'], $row['course_descrlong']);
560560
if(!is_numeric($courseId)) {
561561
echo(" *** Error: Failed to update {$row['qtr']} {$row['subject']}{$row['acad_org']}-{$row['catalog_nbr']}\n");
562562
echo(" ");

0 commit comments

Comments
 (0)