Skip to content

kryali/classwhole

Repository files navigation

http://classwhole.com

Classwhole is a drag-and-drop course scheduler, try it out.

If you find a bug, please file an issue.

Pull requests are welcome!

Overview

Classwhole is built on Rails 3 with AngularJS. We use AngularJS for its excellent data-binding support and for it's dependency injection to organize client-size code. Rails is reponsible for updating course catalog data as well as persisting user schedules and accounts. We use HAML and SASS to generate our front-end HTML/CSS.

The best way to think about how this application works is that Rails produces the API that the client-side AngularJS consumes.

Setup

If you're using linux or a Debian distribution, you can run ubuntu_bootstrap.sh to pull in most of your system level dependencies. It's possible that this file may get out of date.

# Make sure all your gems are up to date 
bundle install  
rake db:create db:migrate

# Scrape course data: This takes a while, I would run this in the background or in a screen
rake data:update       

Development

rails server

Production

bundle exec rake assets:precompile
passenger start

Geeky Stuff

Below are some of the technical highlights in how Classwhole works.

demo

Course Catalog scraping

We scrape course catalog data from the university via an XML API they provide. This runs as a daily cron job to keep course information fresh.

Algorithmic scheduling logic

When a user adds a class or select a different group, we attempt to create a possible schedule server-side and then respond to the client with a success or error message. Ideally this logic would exist on the client to simplify our back-end services and scale up efficiently.

Client side requests

Whenever a user interacts with an element on the page, it ultimately funnels to a service in this folder. This includes class addition, removal, and group modification. The requests are usually dispatched through angular/schedule.js which is set in the controller angular/scheduler.ctrl.js.

Custom autocomplete implementation

In order to pull off a multi-mode search field, custom suggestions, and a Google style typeahead we had to customize the shit out of jQueryUI's autocomplete plugin.

Scraping RateMyProfessor

We use Nokogiri to scrape professor data fom RateMyProfessor as a rake task. This code is pretty easy to pull out if you'd like to use it in your own project.

NOTE: one caveat is that the school doesn't provide us with the complete first name for Professors. We've had this request on the books for nearly two years and is unlikely to get fixed.

Interaction (The Magic)

All schedule interaction follows the flow of event -> schedule#method. The browser event is dispatched via a directive to angular/schedule.js which decides what to do and how to modify the current state of the page. This includes section hovering, class addition, removal, and group switching.

Section Grouping and Data Model

The University provides a course catalog which has a list of all courses. It doesn't provide a way to group courses together. Check the Section Grouping Wiki for our implementation details.

Lots of general cleanup, bug fixes, and features are needed, any help is greatly appreciated.

  1. Fork our project
  2. Pull request!

License

Copyright 2011 Jon Hughes, Kiran Ryali, Scott Wilson

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.