source: WAeUP_SRP/trunk/skins/waeup_student/getGradesFromScore.py @ 4818

Last change on this file since 4818 was 4565, checked in by Henrik Bettermann, 15 years ago

ticket schools #12

  • Property svn:keywords set to Id
File size: 1.5 KB
Line 
1## Script (Python) "getGradeFromScore"
2##bind container=container
3##bind context=context
4##bind namespace=
5##bind script=script
6##bind subpath=traverse_subpath
7##parameters=score=None,level_id=None
8##title=
9##
10# $Id: getGradesFromScore.py 4565 2009-12-21 15:53:09Z henrik $
11
12if level_id:   #for ois only
13    if level_id in ('100', '200', '300'):
14        if score >= 80:
15            return ('A')
16        if score >= 60:
17            return ('C')
18        if score >= 55:
19            return ('P')
20        if score >= 0:
21            return ('F')                               
22    elif level_id in ('400', '500', '600'):
23        if score >= 80:
24            return ('A1')
25        if score >= 75:
26            return ('B2')
27        if score >= 70:
28            return ('B3')
29        if score >= 65:
30            return ('C4')
31        if score >= 60:
32            return ('C5')
33        if score >= 55:
34            return ('C6')
35        if score >= 0:
36            return ('F9')
37    elif level_id == '700':
38        if score >= 80:
39            return ('A')
40        if score >= 65:
41            return ('B')
42        if score >= 55:
43            return ('C')
44        if score >= 45:
45            return ('D')     
46        if score >= 0:
47            return ('F')                 
48    else:
49        return('X')
50else:
51    if score is None:
52        return None,None
53    score = int(score)
54    if score >= 70:
55        return ('A',5)
56    if score >= 60:
57        return ('B',4)
58    if score >= 50:
59        return ('C',3)
60    if score >= 45:
61        return ('D',2)
62    if score >= 40:
63        return ('E',1)
64    return ('F',0)
Note: See TracBrowser for help on using the repository browser.