def shared_meeting_days(first_course, second_course):
	first_course_meeting_days = parser.get_meetings(first_course).keys()
	second_course_meeting_days = parser.get_meetings(second_course).keys()
	days_overlapped = list()
	for meeting_day in first_course_meeting_days:
		if meeting_day in second_course_meeting_days:
			days_overlapped.append(meeting_day)
	return days_overlapped
def shared_meeting_days(first_course, second_course):
    first_course_meeting_days = parser.get_meetings(first_course).keys()
    second_course_meeting_days = parser.get_meetings(second_course).keys()
    days_overlapped = list()
    for meeting_day in first_course_meeting_days:
        if meeting_day in second_course_meeting_days:
            days_overlapped.append(meeting_day)
    return days_overlapped
def course_meeting_times_overlap(first_course, second_course, days_overlapped):
	first_course_meetings = parser.get_meetings(first_course)
	second_course_meetings = parser.get_meetings(second_course)
	for day in days_overlapped:
		first_course_times = first_course_meetings[day]
		second_course_times = second_course_meetings[day]
		for first_course_time in first_course_times:
			for second_course_time in second_course_times:
				if course_times_overlap(first_course_time, second_course_time):
					return True
	return False
def course_meeting_times_overlap(first_course, second_course, days_overlapped):
    first_course_meetings = parser.get_meetings(first_course)
    second_course_meetings = parser.get_meetings(second_course)
    for day in days_overlapped:
        first_course_times = first_course_meetings[day]
        second_course_times = second_course_meetings[day]
        for first_course_time in first_course_times:
            for second_course_time in second_course_times:
                if course_times_overlap(first_course_time, second_course_time):
                    return True
    return False
def course_meets_on_days(course, days_to_check):
	course_meetings = parser.get_meetings(course)
	course_meeting_days = course_meetings.keys()
	for day_to_check in days_to_check:
		if day_to_check in course_meeting_days:
			return True
	return False
def course_meets_on_days(course, days_to_check):
    course_meetings = parser.get_meetings(course)
    course_meeting_days = course_meetings.keys()
    for day_to_check in days_to_check:
        if day_to_check in course_meeting_days:
            return True
    return False
Exemple #7
0
def restrictions():
	if request.method == 'POST':


		schedule_requirements
		sb.set_requirements(schedule_requirements)
		dotw = list()
		for (req, val) in request.form.items():
			if req == 'dotw':
				dotw.append(val)
		
		sb.enter_preferences(no_class_days=dotw)
		schedule = sb.find_schedule()
		my_data = list()
		for i, course in enumerate(schedule):
			temp = dict()
			temp['full_name'] = course['meetings'][0]['section_id_normalized']
			temp['meetings'] = get_meetings(course)
			my_data.append(temp)
		print my_data
		sample_data = [
						{
						"full_name": "NETS 212",
						"requirement_filled": "Arts and Letters",
						"meetings": {
									"days": ["Tuesday", "Thursday"],
									"tod": [12, 13.5]
								  }
						},
						{
						"full_name": "CIS 110",
						"requirement_filled": "Physical World",
						"meetings": {
									"days": ["Monday", "Wednesday", "Friday"],
									"tod": [11, 12]
								  }
						},
						{
						"full_name": "Span 130",
						"requirement_filled": "Something",
						"meetings": {
									"days": ["Monday", "Tuesday", "Wednesday", "Friday"],
									"tod": [12, 13]
								  }
						}
					]
		class_bd = class_by_days(my_data)
		# print class_bd
		print "about to render_template"
		return render_template("your-schedule.html", data=my_data, by_date=class_bd)
	else:
		return render_template("index.html")