Ejemplo n.º 1
0
    def grade(self):
        gradepath = os.path.join(self.paths, 'grades.txt')

        for stcwid, course, grade, inscwid in filereader(gradepath,
                                                         4,
                                                         sep='\t',
                                                         header=False):

            if stcwid in self.st:
                self.st[stcwid].add_course(course, grade)

                if course in self.maj[self.st[stcwid].major].required:

                    if grade in ['A', 'A-', 'B', 'B-', 'C+', 'C']:
                        self.re[stcwid].add(course)

                elif course in self.maj[self.st[stcwid].major].electives:

                    if grade in ['A', 'A-', 'B', 'B-', 'C+', 'C']:
                        self.ele[stcwid].add(course)

            else:
                raise Exception(
                    'Warning : student cwid {} already read from the file'.
                    format(stcwid))

            if inscwid in self.ins:
                self.ins[inscwid].add_coursenum(course)

            else:
                raise Exception(
                    'Warning : instuctor cwid {} already read from the file'.
                    format(inscwid))
Ejemplo n.º 2
0
    def instuctor(self, path):
        inspath = os.path.join(self.paths, path)

        for cwid, name, dept in filereader(inspath, 3, sep='\t', header=False):
            if cwid in self.ins:
                raise Exception(
                    'Warning : cwid {} already read from the file'.format(
                        cwid))
            else:
                self.ins[cwid] = Instuctor(cwid, name, dept)
Ejemplo n.º 3
0
    def student(self, path):
        stpath = os.path.join(self.paths, path)

        for cwid, name, major in filereader(stpath, 3, sep='\t', header=False):
            if cwid in self.st:
                raise Exception(
                    'Warning : cwid {} already read from the file'.format(
                        cwid))
            else:
                self.st[cwid] = Student(cwid, name, major)
Ejemplo n.º 4
0
    def major(self):
        majpath = os.path.join(self.paths, 'majors.txt')

        for major, flag, course in filereader(majpath,
                                              3,
                                              sep="\t",
                                              header=False):

            if major not in self.maj:
                self.maj[major] = Major(major)
                self.maj[major].addcourse(flag, course)

            else:
                self.maj[major].addcourse(flag, course)
Ejemplo n.º 5
0
    def grade(self, path):
        gradepath = os.path.join(self.paths, path)

        for stcwid, course, grade, inscwid in filereader(gradepath,
                                                         4,
                                                         sep='\t',
                                                         header=False):

            if stcwid in self.st:
                self.st[stcwid].add_course(course, grade)
            else:
                raise Exception(
                    'Warning : student cwid {} already read from the file'.
                    format(stcwid))

            if inscwid in self.ins:
                self.ins[inscwid].add_coursenum(course)
            else:
                raise Exception(
                    'Warning : instuctor cwid {} already read from the file'.
                    format(inscwid))