Commit 1009923d authored by Daniel W Bond's avatar Daniel W Bond

Merge branch 'master' of github.com:srct/advisor

parents 5be00b59 115a9404
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Changing field 'Trajectory.user'
db.alter_column(u'mainapp_trajectory', 'user_id', self.gf('django.db.models.fields.related.OneToOneField')(unique=True, to=orm['mainapp.Student']))
def backwards(self, orm):
# Changing field 'Trajectory.user'
db.alter_column(u'mainapp_trajectory', 'user_id', self.gf('django.db.models.fields.related.OneToOneField')(unique=True, to=orm['auth.User']))
models = {
u'auth.group': {
'Meta': {'object_name': 'Group'},
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),
'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'})
},
u'auth.permission': {
'Meta': {'ordering': "(u'content_type__app_label', u'content_type__model', u'codename')", 'unique_together': "((u'content_type', u'codename'),)", 'object_name': 'Permission'},
'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['contenttypes.ContentType']"}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
},
u'auth.user': {
'Meta': {'object_name': 'User'},
'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
'groups': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'related_name': "u'user_set'", 'blank': 'True', 'to': u"orm['auth.Group']"}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'related_name': "u'user_set'", 'blank': 'True', 'to': u"orm['auth.Permission']"}),
'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
},
u'contenttypes.contenttype': {
'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
},
u'mainapp.advisoradminuser': {
'Meta': {'object_name': 'AdvisorAdminUser'},
'created': ('model_utils.fields.AutoCreatedField', [], {'default': 'datetime.datetime.now'}),
'department': ('django.db.models.fields.CharField', [], {'max_length': '50'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'modified': ('model_utils.fields.AutoLastModifiedField', [], {'default': 'datetime.datetime.now'}),
'user': ('django.db.models.fields.related.OneToOneField', [], {'related_name': "'advisorname'", 'unique': 'True', 'to': u"orm['auth.User']"})
},
u'mainapp.buildresponse': {
'Meta': {'object_name': 'BuildResponse'},
'created': ('model_utils.fields.AutoCreatedField', [], {'default': 'datetime.datetime.now'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'modified': ('model_utils.fields.AutoLastModifiedField', [], {'default': 'datetime.datetime.now'}),
'programs': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['mainapp.Program']", 'symmetrical': 'False'}),
'semester': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['mainapp.Semester']"})
},
u'mainapp.concentration': {
'Meta': {'object_name': 'Concentration', '_ormbases': [u'mainapp.Program']},
'associatedmajors': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['mainapp.Major']", 'null': 'True'}),
u'program_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': u"orm['mainapp.Program']", 'unique': 'True', 'primary_key': 'True'})
},
u'mainapp.course': {
'Meta': {'object_name': 'Course', '_ormbases': [u'mainapp.MetaCourse']},
'corequisites': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'related_name': "'coreq+'", 'blank': 'True', 'to': u"orm['mainapp.MetaCourse']"}),
'courseid': ('django.db.models.fields.IntegerField', [], {}),
'credits': ('django.db.models.fields.IntegerField', [], {}),
'dept': ('django.db.models.fields.CharField', [], {'max_length': '10'}),
u'metacourse_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': u"orm['mainapp.MetaCourse']", 'unique': 'True', 'primary_key': 'True'}),
'prerequisites': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'related_name': "'prereq+'", 'blank': 'True', 'to': u"orm['mainapp.MetaCourse']"}),
'uniqname': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '20'})
},
u'mainapp.coursegroup': {
'Meta': {'object_name': 'CourseGroup', '_ormbases': [u'mainapp.MetaCourse']},
'courses': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['mainapp.Course']", 'symmetrical': 'False'}),
u'metacourse_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': u"orm['mainapp.MetaCourse']", 'unique': 'True', 'primary_key': 'True'}),
'numneeded': ('django.db.models.fields.IntegerField', [], {})
},
u'mainapp.gened': {
'Meta': {'object_name': 'GenEd', '_ormbases': [u'mainapp.Program']},
u'program_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': u"orm['mainapp.Program']", 'unique': 'True', 'primary_key': 'True'})
},
u'mainapp.major': {
'Meta': {'object_name': 'Major', '_ormbases': [u'mainapp.Program']},
'concentrations': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': u"orm['mainapp.Concentration']", 'null': 'True', 'blank': 'True'}),
'gened': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['mainapp.GenEd']", 'null': 'True', 'blank': 'True'}),
u'program_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': u"orm['mainapp.Program']", 'unique': 'True', 'primary_key': 'True'})
},
u'mainapp.metacourse': {
'Meta': {'object_name': 'MetaCourse'},
'catalogyear': ('django.db.models.fields.IntegerField', [], {}),
'created': ('model_utils.fields.AutoCreatedField', [], {'default': 'datetime.datetime.now'}),
'description': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'modified': ('model_utils.fields.AutoLastModifiedField', [], {'default': 'datetime.datetime.now'}),
'slug': ('autoslug.fields.AutoSlugField', [], {'unique_with': '()', 'max_length': '50', 'populate_from': "'title'"}),
'title': ('django.db.models.fields.CharField', [], {'max_length': '50'})
},
u'mainapp.minor': {
'Meta': {'object_name': 'Minor', '_ormbases': [u'mainapp.Program']},
u'program_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': u"orm['mainapp.Program']", 'unique': 'True', 'primary_key': 'True'})
},
u'mainapp.program': {
'Meta': {'object_name': 'Program'},
'created': ('model_utils.fields.AutoCreatedField', [], {'default': 'datetime.datetime.now'}),
'description': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'modified': ('model_utils.fields.AutoLastModifiedField', [], {'default': 'datetime.datetime.now'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}),
'requirements': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'reqs+'", 'symmetrical': 'False', 'to': u"orm['mainapp.Requirement']"}),
'slug': ('autoslug.fields.AutoSlugField', [], {'unique_with': '()', 'max_length': '50', 'populate_from': "'name'"})
},
u'mainapp.requirement': {
'Meta': {'object_name': 'Requirement'},
'catalogyear': ('django.db.models.fields.IntegerField', [], {}),
'courses': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['mainapp.MetaCourse']", 'symmetrical': 'False'}),
'created': ('model_utils.fields.AutoCreatedField', [], {'default': 'datetime.datetime.now'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'modified': ('model_utils.fields.AutoLastModifiedField', [], {'default': 'datetime.datetime.now'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
},
u'mainapp.semester': {
'Meta': {'object_name': 'Semester'},
'courses': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['mainapp.Course']", 'symmetrical': 'False', 'blank': 'True'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'nextsemester': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['mainapp.Semester']", 'null': 'True', 'blank': 'True'}),
'number': ('django.db.models.fields.IntegerField', [], {}),
'programs': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'progs+'", 'symmetrical': 'False', 'to': u"orm['mainapp.Program']"}),
'requirementssatisfied': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'related_name': "'reqssatisfied+'", 'blank': 'True', 'to': u"orm['mainapp.Requirement']"}),
'user': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['mainapp.Student']"})
},
u'mainapp.student': {
'Meta': {'object_name': 'Student'},
'advisorname': ('django.db.models.fields.related.OneToOneField', [], {'to': u"orm['mainapp.AdvisorAdminUser']", 'unique': 'True', 'null': 'True', 'blank': 'True'}),
'coursestaken': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': u"orm['mainapp.Course']", 'null': 'True', 'blank': 'True'}),
'created': ('model_utils.fields.AutoCreatedField', [], {'default': 'datetime.datetime.now'}),
'dateOfGrad': ('django.db.models.fields.DateField', [], {}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'modified': ('model_utils.fields.AutoLastModifiedField', [], {'default': 'datetime.datetime.now'}),
'programs': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['mainapp.Program']", 'symmetrical': 'False'}),
'slug': ('autoslug.fields.AutoSlugField', [], {'max_length': '50', 'unique_with': '()', 'null': 'True', 'populate_from': "'user'"}),
'trajectory': ('django.db.models.fields.related.OneToOneField', [], {'to': u"orm['mainapp.Trajectory']", 'unique': 'True', 'null': 'True', 'blank': 'True'}),
'user': ('django.db.models.fields.related.OneToOneField', [], {'to': u"orm['auth.User']", 'unique': 'True'})
},
u'mainapp.trajectory': {
'Meta': {'object_name': 'Trajectory'},
'created': ('model_utils.fields.AutoCreatedField', [], {'default': 'datetime.datetime.now'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'modified': ('model_utils.fields.AutoLastModifiedField', [], {'default': 'datetime.datetime.now'}),
'semesters': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['mainapp.Semester']", 'symmetrical': 'False'}),
'user': ('django.db.models.fields.related.OneToOneField', [], {'related_name': "'trajectory-user'", 'unique': 'True', 'to': u"orm['mainapp.Student']"})
}
}
complete_apps = ['mainapp']
\ No newline at end of file
......@@ -32,7 +32,7 @@ class Semester(models.Model):
number = models.IntegerField("Semester Number")
user = models.ForeignKey(Student)
courses = models.ManyToManyField('Course', blank=True)
programs = models.ManyToManyField('Program')
programs = models.ManyToManyField('Program', related_name="progs+")
nextsemester = models.ForeignKey('self', blank=True, null=True)
requirementssatisfied = models.ManyToManyField('Requirement',
related_name="reqssatisfied+", blank=True,
......@@ -43,7 +43,7 @@ class Semester(models.Model):
class Trajectory(TimeStampedModel):
user = models.OneToOneField(User, related_name="trajectory")
user = models.OneToOneField(Student, related_name="trajectory-user")
semesters = models.ManyToManyField(Semester)
......@@ -78,6 +78,9 @@ class Concentration(Program):
verbose_name="Associated Major")
class RequirementManager(models.Manager):
pass
class Requirement(TimeStampedModel):
name = models.CharField(max_length=50)
courses = models.ManyToManyField('MetaCourse')
......
......@@ -6,10 +6,9 @@ def programCourses(program):
courses = []
requirements = program.requirements
for requirement in requirements:
for coursegroup in requirement.coursegroup:
for course in coursegroup.courses:
courses.append(course)
for requirement in requirements.all():
for course in requirement.courses.all():
courses.append(course)
return courses
......@@ -132,7 +131,11 @@ def nextCourses(remainingReqCourses, taken):
nextcourses = []
for course in remainingReqCourses:
reqs = set()
for prereq in course.preq:
try:
c = Course.objects.get(title=course)
except:
pass
for prereq in c.prerequisites.all():
reqs.add(prereq)
#for coreq in course.coreq:
# reqs.add(coreq)
......@@ -182,13 +185,23 @@ def genTrajectories(taken, programs, user):
if not taken:
taken = ['']
taken = set(taken)
sem = Semester(number=0, user=user, courses=taken,
programs=programs)
tj = Trajectory(user=user, semesters=[sem])
programCourses = []
print taken
sem = Semester(number=0, user=user)
sem.save()
for takencourse in taken:
takencourse.semester=sem
sem.courses = taken
sem.programs = programs
try:
tj = Trajectory.objects.get(user=user)
except:
tj = Trajectory(user=user)
tj.save()
tj.semesters=[sem]
programcourses = []
for program in programs:
programcourses+=programCourses(program)
remainingCourses=remainingReqCourses(taken, programCourses)
programcourses = programcourses + programCourses(program)
remainingCourses=remainingReqCourses(taken, programcourses)
while True:
availableCourses=nextCourses(remainingCourses, taken)
semclasses=[]
......
......@@ -4,6 +4,8 @@
<head>
{% load staticfiles %}
<meta charset="utf-8">
<link rel="icon" type="{% static 'image/ico' %}" href="{% static
'img/academic.ico' %}">
<link href="/static/css/bootstrap.min.css" rel="stylesheet" media="screen">
<link href="/static/css/flat-ui.css" rel="stylesheet" media="screen">
<link href="/static/css/jquery.gridster.min.css" rel="stylesheet" media="screen">
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment