def create_course_ok(self):
        """ This method (handler) executes when the user clicks on "Create Course" in the new course popup """

        # Determine if all entry widgets were filled out
        if (self._NC_course_name_entry.get() and self._NC_course_number_entry.get() and self._NC_course_desc_entry.get() \
           and self._NC_instructor_fname_entry.get() and self._NC_instructor_lname_entry.get() and self._NC_instructor_dep_entry.get() \
           and self._NC_instructor_room_entry.get()):

            # Create Instructor object
            instructor = Instructor(self._NC_instructor_fname_entry.get(),
                                    self._NC_instructor_lname_entry.get(),
                                    self._NC_instructor_dep_entry.get(),
                                    self._NC_instructor_room_entry.get())

            # Set our course field member
            self._course = Course(self._NC_course_name_entry.get(),
                                  self._NC_course_number_entry.get(),
                                  self._NC_course_desc_entry.get(), instructor)

            # Destroy popup window
            self._new_course.destroy()

            # Update appropriate frames and widgets
            self.update_window_title()
            self.update_course_frame()
            self.update_all()
Example #2
0
    def scrape_course(self, course, session):
        global day_list
        if 'fall' in session.lower():
            if course[6].lower() == 'y':
                session = 'Y20189'  #changes depending on year
            else:
                session = 'F20189'
        elif 'winter' in session.lower():
            session = 'S20191'
        elif 'summer' in session.lower():
            session = 'Y20189'
        else:
            print('Not a valid session')
            return

        url = 'http://coursefinder.utoronto.ca/course-search/search/courseInquiry?methodToCall=start&viewId=CourseDetails-InquiryView&courseId=' + course.upper(
        ) + session
        response = get(url)
        if 'The course you are trying to access does not exist' in response.text:
            print('Sorry nothing!')
            return
        soup = bs(response.text, 'html.parser')

        course = Course(course[:6], session[0])  #
        time_td = soup.find_all('td')
        for i in range(0, len(time_td), 8):
            section = time_td[i].text.split()  #0 = type, 1 = number
            times = time_td[i +
                            1].text.split()  #comes in 2s! i = day, i+1 = time
            days = []  #just so i can append
            hours = []
            for j in range(0, len(times), 2):
                day = times[j][:3]
                days.append([day, day_list.index(day)])
                start = int(times[j + 1][:2])
                if int(times[j + 1][3:5]) != "00":
                    minutes = float(times[j + 1][3:5]) / 60
                    start += minutes
                end = int(times[j + 1][6:8])
                if int(times[j + 1][9:11]) != "00":
                    minutes = float(times[j + 1][9:11]) / 60
                    end += minutes
                hours.append((start, end))
            if 'Lec' in section[0]:  #its bound to be one of these ifs
                sec = Lecture(section[1], days, hours)
            if 'Tut' in section[0]:
                sec = Tutorial(section[1], days, hours)
            if 'Pra' in section[0]:
                sec = Practical(section[1], days, hours)
            course.add_section(sec)
        if session[0].lower() == 'y':
            self.AutoTable.year.add_course(course)
        elif session[0].lower() == 'f':
            self.AutoTable.fall.add_course(course)
        elif session[0].lower() == 's':
            self.AutoTable.winter.add_course(course)
        else:
            print('Not a valid session')
            return
Example #3
0
 def course_init(self):
     for course in self.course_set:
         instance = Course(course, self.term, self.year)
         url = self.info + course + self.term['F'] + self.year['F']
         html = self.request(url)
         instance.set_info_page(html)
         self.courses[course] = instance
     UTAnalysis(self.get_courses())
Example #4
0
def generateStudentsList(n):
    grades = [-3, 0, 2, 4, 7, 10, 12]
    courseNames = ['Math', 'English', 'Sports', 'Drama', 'Music']
    firstNames = [{
        'name': 'Elmer',
        'gender': 'Male'
    }, {
        'name': 'Zaid',
        'gender': 'Male'
    }, {
        'name': 'Brandan',
        'gender': 'Male'
    }, {
        'name': 'Damon',
        'gender': 'Male'
    }, {
        'name': 'Gregg',
        'gender': 'Male'
    }, {
        'name': 'Antoinette',
        'gender': 'Female'
    }, {
        'name': 'Joanne',
        'gender': 'Female'
    }, {
        'name': 'Alishia',
        'gender': 'Female'
    }, {
        'name': 'May',
        'gender': 'Female'
    }]
    lastNames = ['Peel', 'Mcnamara', 'Floyd', 'Freeman', 'Butler', 'Hutton']
    students = []
    for i in range(0, n):
        #Courses
        courses = []
        for j in range(0, random.randrange(1, 7)):
            hasGrade = random.randrange(0, 2)
            courseName = courseNames[random.randint(0, len(courseNames) - 1)]
            if hasGrade == 1:
                c = Course.Course(courseName,
                                  'classRoom',
                                  'teacher',
                                  random.randint(5, 25),
                                  grade=grades[random.randint(
                                      0,
                                      len(grades) - 1)])
            elif hasGrade == 0:
                c = Course.Course(courseName, 'classRoom', 'teacher', 0)
            courses.append(c)
        dataSheet = DataSheet.DataSheet(courses)
        studentFirstName = firstNames[random.randint(0, len(firstNames) - 1)]
        studentLastName = lastNames[random.randint(0, len(lastNames) - 1)]
        name = studentFirstName['name'] + ' ' + studentLastName
        s = Student.Student(name, studentFirstName['gender'], 'URL', dataSheet)
        students.append(s)
    return students
Example #5
0
 def register_new_course(self):
     name = input("Course Name?")
     duration = int(input("Course Duration in days?"))
     detail = input("Course details?")
     price = int(input("Course price in integer?"))
     new_course = Course(name, duration, detail, price)
     for i in range(duration):
         material = input(f"What do you want to put material for day {i}\n")
         new_course.add_material_to_course(material)
     self.course_list.append(new_course)
Example #6
0
def initializeData():
    c1 = Course.Course('course1', 'room1', 'teacher1', 1, grade=10)
    c2 = Course.Course('course2', 'room2', 'teacher2', 1, grade=7)
    c3 = Course.Course('course3', 'room3', 'teacher3', 1, grade=4)
    c4 = Course.Course('course4', 'room4', 'teacher4', 1)

    courses = [c1, c2, c3, c4]
    d = DataSheet.DataSheet(courses)
    s = Student.Student('Student1', 'Male', 'img', d)
    return s, d
Example #7
0
 def __init__(self):
   #initialize objects
   self.uni = University.University("UVM", 12000, "Burlington, Vermont", 18000, 45000,[])
   self.cems = College.College("CEMS", 2000, [],[])
   self.cas = College.College("CAS", 3000, [],[])
   self.john = Professor.Professor("John Doe", "Votey 401", False, 3.0,[])
   self.jane = Professor.Professor("Jane Doe", "Votey 402", True, 2.5,[])
   self.sam = Professor.Professor("Sam Doe", "Votey 403", True, 5.0,[])
   self.cs127 = Course.Course("CS 127", 3)
   self.cs424 = Course.Course("CS 424", 18)
   self.cs319 = Course.Course("CS 319", 3)
def listCoreCourses():
    if (Degree.isDegreeLoaded()):
        levels = Course.getCategories(Course.coursesList, 'level')
        for i in levels:
            if 'Core' in i:
                print(i + ':')
                ret = Course.searchCoursesByField(Course.coursesList, i,
                                                  'level')
                for j in ret:
                    print('\t' + j['courseCode'])

    else:
        print("Degree has not been loaded to the program. Please load Degree")
Example #9
0
 def get_courses(self,students):
     for row in range(self.header_row+1,self.s.get_highest_row()+1):
         rowID = 0 
         val1 = self.s.cell(row=row,column=self.id_column).value
         if self.s.cell(row=row,column=self.id_column).data_type == 's':
             # remove hyphens
             val1 = val1.replace('-','')
             rowID = atoi(val1)
         else:
             rowID = int(val1)
         
         student = find_by_id(students,rowID)
         if student is not None:
             title = str(self.s.cell(row=row,column=self.title_column).value)
             if 'Enrolled' in title: continue
             if 'Creative Reading' in title: continue
             course = Course()
             # Get Grade
             course.title = title 
             course.numAvg  = float(self.s.cell(row=row,column=self.grade_column).value)
             course.nCredits = float(self.s.cell(row=row,column=self.credits_column).value)
             course.year = int(self.s.cell(row=row,column=self.year_column).value)
             course.level = int(self.s.cell(row=row,column=self.level_column).value)
             course.PassSummer = False
             if 'yes' in str(self.s.cell(row=row,column=self.summer_column).value).lower():
                 course.PassSummer = True
             student.add_course(course)
Example #10
0
 def get_course_editions(self, course):
     editions = []
     cursor = self.conn.cursor()
     query = cursor.execute("select * from course_editions CE where CE.course_id = ?", (course[0],))
     for eid, cid, sem, year, studnum, tod in query.fetchall():
         editions = editions + [Course((eid, None, None, None, None, None, cid, sem, year, studnum, tod, None, course[1], course[2], course[3]))]
     return editions
Example #11
0
def execute(args, chatter=2):
    """Executes a command on the input type"""
    name = args.NAME
    if (name is None) and (args.mode == "ql"):
        inter = interactive.interface("execute")
        name = inter.request("{0} name".format(args.TYPE))
    elif name is None:
        raise IOError("Cannot execute command on {0} without a name.".format(
            args.TYPE))

    if args.TYPE == 'course':
        course = Course.Course(name)
        course._load(name)
        f = getattr(course, args.command)
        positional_args, varargs, keywords, defaults = inspect.getargspec(f)
        method_args = [vars(args)[a] for a in positional_args[1:]]
        if varargs is not None:
            for va in vars(args)[varargs]:
                method_args.append(va)
        return_args = f(*method_args)
        course._save()
        return return_args

    if args.TYPE == 'roster':
        roster = Roster.Roster(name)
        f = getattr(roster, args.command)
        positional_args, varargs, keywords, defaults = inspect.getargspec(f)
        method_args = [vars(args)[a] for a in argspec[0][1:]]
        if varargs is not None:
            for va in vars(args)[varargs]:
                method_args.append(va)
        return_args = f(*method_args)
        roster._save(name)
        return return_args
Example #12
0
    def addCourse(self, title, location, isMWF, isTTH, startTime, endTime):
        """
        This is the add course logic, this will add a course to the given assignment
        without touching the gui.

        :param title: Title of the Coure to add
        :param location: Location of the course to add
        :param isMWF: Bool, is course on MWF
        :param isTTH: Bool, is course on TTH
        :param startTime: QTime of start of course
        :param endTime: QTime of end of course
        :return: 0 represents the course is added,
                 1 represents not all fields are filled in,
                 2 represents course already exists.
        """

        if title is "" or location is "" or (not isMWF and not isTTH):
            return 1

        for course in self.Courses:
            if course.getTitle() == title:
                return 2

        c = Course(title, startTime, endTime, location, isMWF, isTTH)
        self.Courses.append(c)
        return 0
Example #13
0
    def find_teacher(self, lonely_student, student_time, multiple_hours=False):
        for t in st.teachers:
            if student_time in t.availability:
                teacher_name = t.full_name
                modality = lonely_student.modality
                level = lonely_student.level
                time = student_time

                c = course.Course(teacher_name, modality, level, time)
                self.courses.append(c)

                c.student_list.append(lonely_student)

                # If new course starts an hour before or after student's availability. Wait for confirmation
                if multiple_hours:
                    c.needs_student_confirmation.append(lonely_student)
                    print(
                        f'{lonely_student.full_name} has been assigned to course #{c.id_course}'
                    )
                    print(c)

                lonely_student.assigned_course = c.id_course
                lonely_student.has_course = True

                t.availability.remove(time)

                break
Example #14
0
    def setup(self):

        toAddQtr = input('Enter the quarter (Eg. FALL 2015): ')
        toAddQtr = re.compile('\w+').findall(toAddQtr)
        term = toAddQtr[0].upper()
        year = toAddQtr[1]

        qtr = Quarter.quarter(term, year)

        while True:
            toAddCourse = input('Enter the course (Eg. CSE 30): ')

            if toAddCourse == "":
                break

            toAddCourse = re.compile('\w+').findall(toAddCourse)
            dpt = toAddCourse[0].upper()
            num = toAddCourse[1].upper()
            units = input('Enter the units: ')
            units = float(units)

            course = Course.course(dpt,num,units)

            qtr.addCourse(course)

        return qtr
Example #15
0
    def setup(self):

        toAddQtr = input('Enter the quarter (Eg. FALL 2015): ')
        toAddQtr = re.compile('\w+').findall(toAddQtr)
        term = toAddQtr[0].upper()
        year = toAddQtr[1]

        qtr = Quarter.quarter(term, year)

        while True:
            toAddCourse = input('Enter the course (Eg. CSE 30): ')

            if toAddCourse == "":
                break

            toAddCourse = re.compile('\w+').findall(toAddCourse)
            dpt = toAddCourse[0].upper()
            num = toAddCourse[1].upper()
            units = input('Enter the units: ')
            units = float(units)

            course = Course.course(dpt, num, units)

            qtr.addCourse(course)

        return qtr
Example #16
0
    def loadScript(self,lessonScriptPath):
        lessonScriptPath = self.completeLessonScriptPath(lessonScriptPath)

        courseName = 'STANDARD_COURSE' ###- TODO, implement get course name
        course = Course.Course(courseName,self.application)

        moduleName = self.getModuleNameFromLessonScriptPath(lessonScriptPath)
        lessons = {}
        module = Module.Module(moduleName,lessons,course)

        lessonName = self.getLessonNameFromLessonScriptPath(lessonScriptPath)
        pages = {}
        module.lessons[lessonName] = Lesson.Lesson(lessonName,pages,module)

        try :
            with open(lessonScriptPath,"r",encoding="utf-8") as scriptFile :
                for lessonScriptLine in scriptFile :
                    if lessonScriptLine != '\n' :
                        pageName = self.getPageNameFromLessonScriptLine(lessonScriptLine)
                        pageScript = lessonScriptLine.strip()
                        module.lessons[lessonName].pages[pageName] = Page.Page(pageName,pageScript,module.lessons[lessonName])
        except :
            with open(lessonScriptPath,"+w",encoding="utf-8") as scriptFile : pass

        return module.lessons[lessonName]
Example #17
0
def query_websoc(course_codes: [int]) -> [Course]:
    classes = []
    for course_codes in [
            course_codes[i:i + 6] for i in range(0, len(course_codes), 6)
    ]:
        str_course_codes = ','.join([str(x) for x in course_codes])
        ## TODO:
        ## check to make sure its actually websoc before trying to scrape
        url = 'http://websoc.reg.uci.edu/perl/WebSoc'
        values = {
            'Submit': 'Display Web Results',
            'YearTerm': WEBSOC_TERM,
            'ShowComments': 'on',
            'ShowFinals': 'on',
            'CourseCodes': str_course_codes,
        }
        data = urllib.parse.urlencode(values)
        data = data.encode('utf-8')
        req = urllib.request.Request(url, data)
        with urllib.request.urlopen(req) as response:
            the_page = response.read()
            soup = BeautifulSoup(the_page)

            lines = soup.find_all('td', text=course_codes)
            for line in lines:
                classes.append(Course(line))

    return classes
Example #18
0
    def add_course(self, admin, name):
        """(TutorTimes, Admin, str) -> str
        Given an admin and the name of the course, generate a auth code for the course, and add
        it to the system, and returns the course code generated for the course.
        """
        # create an 5 letter course code for the course
        course_code = ''.join(
            random.SystemRandom().choice(string.ascii_uppercase +
                                         string.digits) for _ in range(5))

        # while the auth_code exists already in system
        while course_code in self._course_code_to_course:

            # generate a new auth code
            course_code = ''.join(
                random.SystemRandom().choice(string.ascii_uppercase +
                                             string.digits) for _ in range(5))

        # create the course object
        new_course = Course(admin, self, name)

        # add the course to the dict
        self._course_code_to_course[course_code] = new_course

        # return course code
        return course_code
Example #19
0
    def test_removeCourse(self):
        mySchedule = PyScheduleLogic()

        myCourse = Course.Course('course1', 'location1', True, False, 'start',
                                 'end')
        mySchedule.appendCourse(myCourse)

        self.assertEqual(len(mySchedule.Courses), 1)

        mySchedule.removeCourse(myCourse)

        self.assertEqual(len(mySchedule.Courses), 0)

        mySchedule.appendCourse(myCourse)

        # add 500 differnet courses
        for i in range(1, 500):
            self.assertEqual(
                0,
                mySchedule.addCourse('title({})'.format(i), 'location', False,
                                     True, 'startTime', 'endTime'))

        mySchedule.removeCourse(myCourse)

        # Ensure course is gone
        for c in mySchedule.Courses:
            self.assertNotEqual(c.getTitle(), myCourse.getTitle())

        # delete all
        for c in mySchedule.Courses:
            mySchedule.removeCourse(c)

            # Ensure course is gone
            for c2 in mySchedule.Courses:
                self.assertNotEqual(c.getTitle(), c2.getTitle())
Example #20
0
def readData():
    students = open('Student.txt', 'r')
    courses = open('Course.txt', 'r')
    grades = open('Grades.txt', 'r')

    for line in students:
        temp = line.split(', ', 2)
        temp[2] = temp[2].replace("\n", "")
        tempStudent = Student.Student(int(temp[0]), temp[1], temp[2])
        studentList.append(tempStudent)

    for line in courses:
        temp = line.split(', ', 2)
        temp[2] = temp[2].replace("\n", "")
        tempCourse = Course.Course(int(temp[0]), temp[1], temp[2])
        courseList.append(tempCourse)

    for line in grades:
        temp = line.split(', ', 5)
        temp[5] = temp[5].replace("\n", "")
        tempGrade = Grades.Grades(int(temp[0]), int(temp[1]), float(temp[2]),
                                  float(temp[3]), float(temp[4]),
                                  float(temp[5]))
        gradeList.append(tempGrade)

    students.close()
    courses.close()
    grades.close()
    return
Example #21
0
def add_course():
    print("Enter course code: ")
    code = raw_input()
    print("Enter units: ")
    units = float(raw_input())
    courseList.append(Course(code, units))
    print("Successfuly added")
    return
Example #22
0
    def listCourse(cls):
        query_course_info_sql = "SELECT * FROM course_info"
        raw = super().readFromDB(query_course_info_sql)

        data = {}
        for d in raw:
            data[d[0]] = Course.Course(d[0], d[1], d[2])
        return data
Example #23
0
def addCourses(schedule):
    global courses
    with open(schedule) as f:
        content = f.read().splitlines()
    for i in range(0,len(content)):
        c = content[i].split(',')
        courses.append(Course.Course(int(c[0]),c[1],int(c[2]),c[3]))
    return courses
Example #24
0
def setupCourse():
    toAddCourse = input('Enter the course (Eg. CSE 30): ')
    toAddCourse = re.compile('\w+').findall(toAddCourse)
    dpt = toAddCourse[0].upper()
    num = toAddCourse[1].upper()
    units = input('Enter the units: ')
    units = float(units)
    course = Course.course(dpt,num,units)
    return course
 def select_courses(self):
     self._c.execute("SELECT * FROM courses")
     courses = self._c.fetchall()
     returnCourses = []
     for i in range(0, len(courses)):
         returnCourses.append(
             Course.Course(courses[i][0], courses[i][1],
                           self.select_course_instructors(courses[i][0]),
                           courses[i][2]))
     return returnCourses
Example #26
0
def addCourse():
    code = input("Enter Course Code: ")
    name = input("Enter Course Name: ")
    id = courseList[len(courseList) - 1].getId() + 1

    tempCourse = Course.Course(id, code, name)
    courseList.append(tempCourse)
    cls()
    print(code, "has been added to the course list!")
    return
Example #27
0
def update_courses(courses):
    workbook = xl.load_workbook('courses.xlsx')
    worksheet = workbook[workbook.sheetnames[0]]

    i = 1
    while worksheet['A' + str(i)].value:
        id = str(worksheet['A' + str(i)].value)
        title = str(worksheet['B' + str(i)].value)
        courses[id] = Course.Course(id, title)
        i += 1
Example #28
0
 def decode_course_list_from_json(self):
     course_list = FileHandling.retrieve_course_info()
     courses = []
     for course in course_list:
         new_course = Course(course['name'], course['duration'],
                             course['detail'], course['price'],
                             course['_Course__enrolled_student'],
                             course['_Course__student_info_for_course'],
                             course['_Course__study_material'])
         courses.append(new_course)
     return courses
Example #29
0
def create_course(school, data):
    department = input('Please enter the department offering the new course: ').strip()
    number = input('Please enter the new course number: ').strip()
    name = input('Please enter the new course name: ').strip()
    c_credits = input('Please enter the new course credits: ').strip().replace(' ', '')
    course = Course.Course(department, number, name, c_credits)
    school.add_course(course)
    data.courses_df = \
        data.courses_df.append({'department': department, 'number': number, 'name': name, 'credits': c_credits,
                                'courseidentifier': course.courseidentifier}, ignore_index=True)
    print('Successfully create a course.')
    save_to_disk(school, data)
Example #30
0
 def __init__(self, game, is_full_round):
     if is_full_round:
         print("Creating Full Course...")
     else:
         print("Creating Half Course...")
     hole_sizes = self.calculate_hole_sizes(is_full_round)
     #print(hole_sizes)
     #print(self.total_par(hole_sizes))
     self.course = Course.Course(game)
     for i in enumerate(hole_sizes):
         hc = HoleCreator.HoleCreator(self.course, i[0] + 1, i[1])
         self.course.add_hole(hc.hole)
def create_course_helper(file_name):
    '''
    (str) -> Course
    Given the name of a file that includes all grades in a course, read the
    file and return the course by creating all the category and enter the grade
    REQ: file should be in the specific format
    '''

    # Open the file and create the course
    file = open(file_name, 'r')
    course = Course(file_name[:-4])
    for each_line in file:
        # split the file by the space
        line_element = each_line.split()
        # Get the first element in the file
        category_name = line_element[0]
        # Get the percentage of the category
        category_percentage = float(line_element[1])
        # Add the new category
        course.add_category(category_name, category_percentage)
        # Add the grade into the course
        for index in range(2, len(line_element)):
            course.add_grade(category_name, float(line_element[index]),
                             index - 1)
    # Close the file
    file.close()
    # Return the new course
    return course
Example #32
0
def factory(object_name, **kwargs):
    try:
        obj = objects[object_name]
    except KeyError:
        raise 'Object not found.'

    for , index in enumerate(available_courses):
        courses[course] = Course(
            code=index,
            name=course,
            classroom=(100 + index)
            teacher=casir
        )
Example #33
0
 def map(self):
     import User
     User.init_db()
     import Campus
     Campus.init()
     import Class
     Class.init()
     import ClassRoom
     ClassRoom.init()
     import Course
     Course.init()
     import Cursus
     Cursus.init()
     import Event
     Event.init()
     import Period
     Period.init()
     import Planning
     Planning.init()
     import Settings
     Settings.init()
     import University
     University.init()
Example #34
0
	def map(self):
		import User
		User.init_db()
		import Campus
		Campus.init()
		import Class
		Class.init()
		import ClassRoom
		ClassRoom.init()
		import Course
		Course.init()
		import Cursus
		Cursus.init()
		import Event
		Event.init()
		import Period
		Period.init()
		import Planning
		Planning.init()
		import Settings
		Settings.init()
		import University
		University.init()
    def build_account_object(self, received_list):
        """
        This functions builds an account object which can be written directly to the database. The function received a
        list containing the teacher, course, groups and students plus semester.

        Example list style: [{"teacher": ["Teachername"], {"course":["Coursename"]}...}]
        :param received_list:
        :type received_list:
        :return account:
        :rtype DbAccount:
        """
        account = DbAccount()
        teacher = Teacher()
        course = Course()
        group = Group()
        groupdict = {}
        for i in received_list:
            for key, value in i.iteritems():
                if "teacher" in key:
                    teacher.set_name(value[0])
                elif "semester" in key:
                    teacher.set_semester(value[0])
                elif "course" in key:
                    course.set_coursename(value[0])
                elif "group" in key:
                    for groupkey, memberlist in value.iteritems():
                        group = Group()
                        groupdict.update({groupkey: memberlist})
                        group.set_groupname(groupkey)
                        group.set_students(memberlist)
                        if any(x.get_groupname() == groupkey for x in course.get_groups()):
                            logging.info(groupkey + " exists in the object from before")
                        else:
                            course.set_group_list(group)
        teacher.set_course(course)
        account.set_teacher(teacher)
        return account
Example #36
0
    def get_courses(self,students,final_term):
        now = datetime.datetime.now()
        year = now.year
        if now.month < 8:
            year = year - 1
        print 'Reading current courses and setting year as',year

        # For 2012-2013 here are the course credit aslottments
        # This is used to determine the number of credits for 
        # current-year courses on-the-fly
        #courses_3credit = {
        #'Biology','Integrated Algebra','Korean I',
        #'Chemistry','Geometry','Global History II: Enlightenment to Present Day',
        #'Physics','Algebra II','U.S. History','Korean III','Algebra II/Trigonometry',
        #'AP Biology','Intro to Calculus','Pre-Calculus','Senior Literature','AP Eng Lang \& Comp',

        #'Literature I','Writing I','Global History I: Mesopotamia to Renaissance',
        #'Literature II','Writing II','Korean II','American Literature',
        #'Literature III','Writing III','AP Physics',
        #'Korean Literature & Culture','Korean IV - Regents Prep',
        #'Korean Lit. \& Culture'
        #}
        #courses_2credit = [
        #'Applied Civics II: Seminar in American Democracy',
        #'Sem in Amer Democ'
        #]
        #courses_1credit = [
        #'Physics Topics','Scientific Literacy',
        #'Topics in Physics','Economics'
        #]
        #courses_5credit = [
        #'Theatre for Social Change with The Laramie Project','Physical Education','Advanced Theatre'
        #]

        for row in range(self.header_row+1,self.s.get_highest_row()+1):
            term = str(self.s.cell(row=row,column=self.term_column).value)
            # Check that this row corresponds to requested term
            if term not in ['F1','F2','F3']:
            #if term not in ['T1','T2','T3']:
                continue
                
            rowID = 0 
            val1 = self.s.cell(row=row,column=self.id_column).value
            if self.s.cell(row=row,column=self.id_column).data_type == 's':
                # remove hyphens
                val1 = val1.replace('-','')
                rowID = atoi(val1)
            else:
                rowID = int(val1)
            
            student = find_by_id(students,rowID)
            #if student is None:
                #print 'Warning: Missing student with ID =',rowID  
            #else:
            if student is not None:
                title = str(self.s.cell(row=row,column=self.title_column).value)
                #title = title.replace('&','\&')  # Protect against naughty character
                #title = title.replace('Korean Literature','Korean Lit.')  # Shorten Kor Lit Title
                #title = title.replace('Korean IV - Regents Prep','Korean IV')  # Shorten Kor IV Title
                #title = title.replace('Applied Civics II: ','')  # Shorten Civics Seminar
                #title = title.replace('Seminar in American Democracy','Sem in Amer Democ')  # Shorten Civics Seminar
                #title = title.replace('AP English Language and Composition','AP Eng Lang \& Comp')  # Shorten AP English

                if self.s.cell(row=row,column=self.grade_column).value == None:
                    continue
                course = Course()
                # Check if Course already in for different term
                for c in student.get_courses(year):
                    if c.title == title:
                        course = c
                    
                # Fill course information
                if len(course.term_grades) == 0:
                    course.title = title 
                    course.current = True
                    course.year = year
                    if 'Hon' in title:
                        course.level = 2
                    elif 'AP' in title:
                        course.level = 3
                    else:
                        course.level = 1
                
                # Fill grade
                course.term_grades[term] = float(self.s.cell(row=row,column=self.grade_column).value)
                if term == final_term:
                    course.numAvg  = float(self.s.cell(row=row,column=self.grade_column).value)

                #stripTitle = title.replace(' (Hon)','')
                #stripTitle = stripTitle.replace(' Accelerated','')
                #if stripTitle in courses_3credit:
                #    course.nCredits = 3
                #elif stripTitle in courses_2credit:
                #    course.nCredits = 2
                #elif stripTitle in courses_1credit:
                #    course.nCredits = 1
                #elif stripTitle in courses_5credit:
                #    course.nCredits = 0.5
                #else:
                #    course.nCredits = 0
                    
                
                if len(course.term_grades) == 1:
                    student.add_course(course)
Example #37
0
            be = None
            if line.__len__() > 0:
                be = line[0]

            if be == 'FALL' or be == 'WINTER' or be == 'SPRING' or be == 'SUMMER':
                term = line[0].upper()
                year = line[1]
                qtr = Quarter.quarter(term,year)

            elif be == '\t':
                dept = line[1].upper()
                num = line[2].upper()
                units = float(line[3])
                grade = line[4].upper()
                course = Course.course(dept,num,units)
                course.setGrade(grade)
                qtr.addCourse(course)

            elif be == "Total":
                addQuarter(qtr)
                numQuarters += 1
                qtr = None

        print("\t>\t" + str(numQuarters) + " quarter read from file.")
        originalGPA = getGenGPA(quarters)
        print("\t>\tOriginal GPA set to " + str(originalGPA) + ".")
        fid.close()

    elif opt == 'i':