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

Last change on this file since 3730 was 3707, checked in by Henrik Bettermann, 16 years ago
  • OIS customizations according to Issoufou's wish list of Oct 2 (2, 4, 5, 6, 7, 8)
  • Property svn:keywords set to Id
File size: 1.2 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 3707 2008-10-04 05:41:27Z henrik $
11
12if level_id:
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    else:
38        return('X')
39else:
40    if score is None:
41        return None,None
42    score = int(score)
43    if score >= 70:
44        return ('A',5)
45    if score >= 60:
46        return ('B',4)
47    if score >= 50:
48        return ('C',3)
49    if score >= 45:
50        return ('D',2)
51    if score >= 40:
52        return ('E',1)
53    return ('F',0)
Note: See TracBrowser for help on using the repository browser.