Changeset 3602 for WAeUP_SRP/base


Ignore:
Timestamp:
5 Aug 2008, 20:03:27 (16 years ago)
Author:
Henrik Bettermann
Message:

first tools for transcripts (untested)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • WAeUP_SRP/base/WAeUPTables.py

    r3497 r3602  
    16111611###)
    16121612
     1613    def getAllCourses(self,student_id): ###(
     1614        query = Eq('student_id',student_id)
     1615        course_results = self.course_results.evalAdvancedQuery(query)
     1616        for brain in course_results:
     1617            d = {}
     1618
     1619            for field in self.schema():
     1620                d[field] = getattr(brain,field,'')
     1621
     1622            d['weight'] = ''
     1623            d['grade'] = ''
     1624            d['score'] = ''
     1625
     1626            if str(brain.credits).isdigit():
     1627                credits = int(brain.credits)
     1628                score = getattr(brain,'score',0)
     1629                if score and str(score).isdigit() and int(score) > 0:
     1630                    score = int(score)
     1631                    grade,weight = self.getGradesFromScore(score)
     1632                    d['weight'] = weight
     1633                    d['grade'] = grade
     1634                    d['score'] = score
     1635            d['coe'] = ''
     1636            if brain.core_or_elective:
     1637                d['coe'] = 'Core'
     1638            elif brain.core_or_elective == False:
     1639                d['coe'] = 'Elective'
     1640            id = code = d['id'] = brain.code
     1641            d['code'] = code
     1642            res = self.courses_catalog.evalAdvancedQuery(Eq('code',code))
     1643            if res:
     1644                course = res[0]
     1645                d['title'] = course.title
     1646                # The courses_catalog contains strings and integers in its semester field.
     1647                # Maybe this can be fixed by reindexing the catalog. The schema of course says 'CPS Int Field'.
     1648                d['semester'] = str(course.semester)
     1649            else:
     1650                d['title'] = "Course has been removed from course list"
     1651                d['semester'] = ''
     1652            if brain.carry_over:
     1653                d['coe'] = 'CO'
     1654            courses.append(d)
     1655        return courses
     1656    ###)
     1657
     1658InitializeClass(CourseResults)
     1659###)
     1660
    16131661class OnlinePaymentsImport(WAeUPTable): ###(
    16141662
Note: See TracChangeset for help on using the changeset viewer.