Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
scheduler separate app (original files unchanged for now)
- Loading branch information
Showing
8 changed files
with
198 additions
and
1 deletion.
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from django.db import models | ||
|
||
# Create your models here. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,144 @@ | ||
{% extends "application.html" %} | ||
|
||
{% load utilities %} | ||
|
||
{% block content %} | ||
|
||
<h1>Scheduler</h1><br/><br/> | ||
|
||
<form action="." method="POST"> | ||
<span>Enter a list of classes separated commas</span><br/> | ||
|
||
<input name="classes" /> | ||
<select name="term"> | ||
<option value="F">Fall</option> | ||
<option value="W">Winter</option> | ||
<option value="Sp">Spring</option> | ||
<option value="Su">Summer</option> | ||
</select> | ||
<select name="year"> | ||
<option value="11">2011</option> | ||
<option value="12">2012</option> | ||
<option value="13">2013</option> | ||
</select> | ||
<input type="submit" value="Submit" /> | ||
<br/> | ||
</form> | ||
|
||
{% if combinations %} | ||
|
||
{% block header %} | ||
<link rel="stylesheet" type="text/css" href="/site_media/stylesheets/make_schedule.css" /> | ||
<script type="text/javascript" src="/site_media/javascripts/jquery-min.js" ></script> | ||
<script> | ||
combinations = {{json|safe}} | ||
</script> | ||
|
||
<script type="text/javascript" src="/site_media/javascripts/make_schedule.js" ></script> | ||
{% endblock %} | ||
<div class="span-24 last"> | ||
<div class="span-18"> | ||
<table> | ||
<tr id="headers"> | ||
<th>Hour</th> | ||
<th>Monday</th> | ||
<th>Tuesday</th> | ||
<th>Wednesday</th> | ||
<th>Thursday</th> | ||
<th>Friday</th> | ||
<th>Saturday</th> | ||
<th>Sunday</th> | ||
</tr> | ||
{% for hour in range %} | ||
<tr id="hour-{{hour}}" class="hours"> | ||
<td class="Hour">{{hour}}:00</td> | ||
<td class="Monday"></td> | ||
<td class="Tuesday"></td> | ||
<td class="Wednesday"></td> | ||
<td class="Thursday"></td> | ||
<td class="Friday"></td> | ||
<td class="Saturday"></td> | ||
<td class="Sunday"></td> | ||
</tr> | ||
<tr id="hour-{{hour}}-half" class="hours"> | ||
<td class="Hour">{{hour}}:30</td> | ||
<td class="Monday"></td> | ||
<td class="Tuesday"></td> | ||
<td class="Wednesday"></td> | ||
<td class="Thursday"></td> | ||
<td class="Friday"></td> | ||
<td class="Saturday"></td> | ||
<td class="Sunday"></td> | ||
</tr> | ||
{% endfor %} | ||
</table> | ||
</div> | ||
<div id="combinations" class="span-6 last"> | ||
<h5><img alt="Complete combination" src="/site_media/images/check16.png"></img> Complete combination</h5> | ||
{% for combination in combinations %} | ||
<div id="combination-{{forloop.counter}}" class="combination"> | ||
<h4> | ||
{% ifequal combination|length classes_possible%} | ||
<img src="/site_media/images/check16.png" alt="Complete combination"></img> | ||
{% endifequal %} | ||
Combination {{forloop.counter}} | ||
</h4> | ||
|
||
{% for class in combination %} | ||
<div class="{{class.crn}} colorbox" style="width:10px; height:10px; display:none"></div> | ||
<span>({{class.type}}) {{class.department|upper}} {{class.number}} </span> | ||
<span> | ||
{% ifnotequal class.times "TBA" %} | ||
{{class.days|join:"" }} | ||
{{ class.times|join:"-" }} | ||
{% endifnotequal %} | ||
</span><br/> | ||
{% endfor %} | ||
<br/> | ||
</div> | ||
{% endfor %} | ||
</div> | ||
<div id="combinations-full" class="span-24 last"> | ||
{% for combination in combinations %} | ||
<div id="combinationfull-{{forloop.counter}}" class="combination-full"> | ||
<h3> | ||
{% ifequal combination|length classes_possible%} | ||
<img src="/site_media/images/check16.png" alt="Complete combination"></img> | ||
{% endifequal %} | ||
Combination {{forloop.counter}} | ||
</h4> | ||
<table> | ||
<tr> | ||
<th>Class</th> | ||
<th>Title</th> | ||
<th>Type</th> | ||
<th>Instructor</th> | ||
<th>Days</th> | ||
<th>Time</th> | ||
<th>CRN</th> | ||
</tr> | ||
{% for course in combination %} | ||
<tr> | ||
<td><a href="/course/{{course.department|upper}}{{course.number}}">{{course.department|upper}} {{course.number}}</a></td> | ||
<td>{{course.title}}</td> | ||
<td>{{course.type}}</td> | ||
<td>{{course.instructor}}</td> | ||
<td>{{course.days|join:"" }}</td> | ||
{% ifnotequal course.times "TBA" %} | ||
<td>{{course.times|join:"-" }}</td> | ||
{% else %} | ||
<td>TBA</td> | ||
{% endifnotequal %} | ||
<td>{{course.crn}}</td> | ||
</tr> | ||
{% endfor %} | ||
|
||
</table> | ||
<br/> | ||
</div> | ||
{% endfor %} | ||
</div> | ||
|
||
{% endif %} | ||
|
||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
""" | ||
This file demonstrates writing tests using the unittest module. These will pass | ||
when you run "manage.py test". | ||
Replace this with more appropriate tests for your application. | ||
""" | ||
|
||
from django.test import TestCase | ||
|
||
|
||
class SimpleTest(TestCase): | ||
def test_basic_addition(self): | ||
""" | ||
Tests that 1 + 1 always equals 2. | ||
""" | ||
self.assertEqual(1 + 1, 2) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
from django.conf.urls.defaults import * | ||
from reggit import main | ||
from django.conf import settings | ||
|
||
urlpatterns = patterns('scheduler.views', | ||
(r'^$', 'index'), | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
from django.shortcuts import render_to_response | ||
from django.http import Http404 | ||
import simplejson as json | ||
from django.http import HttpResponseRedirect | ||
import reglib | ||
|
||
def index(request): | ||
if not 'regclass' in request.session: | ||
return HttpResponseRedirect('/') | ||
|
||
if request.method == 'GET': | ||
return render_to_response('scheduler/index.html') | ||
regclass = request.session['regclass'] | ||
#try: | ||
classes = request.POST['classes'].split(', ') | ||
term_year = request.POST['term'] + request.POST['year'] | ||
results = regclass.make_schedule(classes, term_year) | ||
combinations = results['combinations'] | ||
classes_possible = results['classes_possible'] | ||
combinations_json = json.dumps(combinations) | ||
#except: | ||
#return render_to_response('scheduler/index.html') | ||
|
||
return render_to_response('scheduler/index.html', {'combinations':combinations, 'json':combinations_json, 'range':range(24), 'classes_possible':classes_possible}) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -84,4 +84,5 @@ | |
'schedule', | ||
'transcript', | ||
'course', | ||
'scheduler', | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters