source: main/kofacustom.edopoly/trunk/src/kofacustom/edopoly/students/studylevel.py @ 15669

Last change on this file since 15669 was 15013, checked in by Henrik Bettermann, 7 years ago

Customize GPABoundaries.

Change fee categories.

  • Property svn:keywords set to Id
File size: 3.0 KB
RevLine 
[10765]1## $Id: studylevel.py 15013 2018-05-20 19:44:44Z henrik $
2##
3## Copyright (C) 2012 Uli Fouquet & Henrik Bettermann
4## This program is free software; you can redistribute it and/or modify
5## it under the terms of the GNU General Public License as published by
6## the Free Software Foundation; either version 2 of the License, or
7## (at your option) any later version.
8##
9## This program is distributed in the hope that it will be useful,
10## but WITHOUT ANY WARRANTY; without even the implied warranty of
11## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12## GNU General Public License for more details.
13##
14## You should have received a copy of the GNU General Public License
15## along with this program; if not, write to the Free Software
16## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17##
18"""
19Container which holds the data of a student study level
20and contains the course tickets.
21"""
22import grok
23from zope.component.interfaces import IFactory
24from zope.interface import implementedBy
25from waeup.kofa.utils.helpers import attrs_to_fields
26from waeup.kofa.students.studylevel import (
27    StudentStudyLevel, CourseTicket,
28    CourseTicketFactory, StudentStudyLevelFactory)
29from waeup.kofa.students.interfaces import IStudentNavigation
[15000]30from kofacustom.edopoly.students.interfaces import (
[10765]31    ICustomStudentStudyLevel, ICustomCourseTicket)
32
33
34class CustomStudentStudyLevel(StudentStudyLevel):
35    """This is a container for course tickets.
36    """
37    grok.implements(ICustomStudentStudyLevel, IStudentNavigation)
38    grok.provides(ICustomStudentStudyLevel)
39
40CustomStudentStudyLevel = attrs_to_fields(
41    CustomStudentStudyLevel, omit=['total_credits', 'gpa'])
42
43class CustomStudentStudyLevelFactory(StudentStudyLevelFactory):
44    """A factory for student study levels.
45    """
46
47    def __call__(self, *args, **kw):
48        return CustomStudentStudyLevel()
49
50    def getInterfaces(self):
51        return implementedBy(CustomStudentStudyLevel)
52
53class CustomCourseTicket(CourseTicket):
54    """
[15013]55    """
[10765]56    grok.implements(ICustomCourseTicket, IStudentNavigation)
57    grok.provides(ICustomCourseTicket)
58
[15013]59    @property
60    def _getGradeWeightFromScore(self):
61        """EdoPoly Course Grading System
62        """
63        if self.total_score is None:
64            return (None, None)
65        if self.total_score >= 75:
66            return ('AA',4)
67        if self.total_score >= 70:
68            return ('A',3.5)
69        if self.total_score >= 65:
70            return ('AB',3.25)
71        if self.total_score >= 60:
72            return ('B',3.0)
73        if self.total_score >= 55:
74            return ('BC',2.75)
75        if self.total_score >= 50:
76            return ('C',2.5)
77        if self.total_score >= 45:
78            return ('CD',2.25)
79        if self.total_score >= 40:
80            return ('D',2)
81        return ('F',0)
[10765]82
83CustomCourseTicket = attrs_to_fields(CustomCourseTicket)
84
85class CustomCourseTicketFactory(CourseTicketFactory):
86    """A factory for student study levels.
87    """
88
89    def __call__(self, *args, **kw):
90        return CustomCourseTicket()
91
92    def getInterfaces(self):
93        return implementedBy(CustomCourseTicket)
Note: See TracBrowser for help on using the repository browser.