Changeset 7625 for main/waeup.sirp/trunk/src/waeup/sirp
- Timestamp:
- 10 Feb 2012, 20:05:55 (13 years ago)
- Location:
- main/waeup.sirp/trunk/src/waeup/sirp/students
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.sirp/trunk/src/waeup/sirp/students/tests/test_vocabularies.py
r7616 r7625 36 36 values = studylevelsource.getValues(studycourse) 37 37 self.assertEqual(values, [100, 110, 120, 200, 210, 220, 300, 310, 320, 38 400, 410, 420, 500, 510, 520, 600, 610]) 39 self.assertTrue(studylevelsource.getTitle(studycourse, 0), 38 400, 410, 420, 500, 510, 520, 600, 610, 620]) 39 self.assertEqual(studylevelsource.getTitle(studycourse, None), 40 'Error: level id None out of range') 41 self.assertEqual(studylevelsource.getTitle(studycourse, 0), 40 42 'Error: level id 0 out of range') 41 self.assert True(studylevelsource.getTitle(studycourse, 10),43 self.assertEqual(studylevelsource.getTitle(studycourse, 10), 42 44 'Error: level id 10 out of range') 43 self.assert True(studylevelsource.getTitle(studycourse, 100),45 self.assertEqual(studylevelsource.getTitle(studycourse, 100), 44 46 '100 (Year 1)') 45 self.assert True(studylevelsource.getTitle(studycourse, 110),46 '100 (Year 1) on 1 .probation')47 self.assert True(studylevelsource.getTitle(studycourse, 120),48 '100 (Year 1) on 2 .probation')49 self.assert True(studylevelsource.getTitle(studycourse, 500),47 self.assertEqual(studylevelsource.getTitle(studycourse, 110), 48 '100 (Year 1) on 1st probation') 49 self.assertEqual(studylevelsource.getTitle(studycourse, 120), 50 '100 (Year 1) on 2nd probation') 51 self.assertEqual(studylevelsource.getTitle(studycourse, 500), 50 52 '500 (Year 5)') 51 self.assert True(studylevelsource.getTitle(studycourse, 600),52 '500 (Year 5) spillover')53 self.assert True(studylevelsource.getTitle(studycourse, 610),53 self.assertEqual(studylevelsource.getTitle(studycourse, 600), 54 '500 (Year 5) 1st spillover') 55 self.assertEqual(studylevelsource.getTitle(studycourse, 610), 54 56 '500 (Year 5) 2nd spillover') 55 self.assertTrue(studylevelsource.getTitle(studycourse, 620), 56 'Error: level id 620 out of range') 57 self.assertTrue(studylevelsource.getTitle(studycourse, 900), 58 'Error: level id 900 out of range') 59 # Now we change the certificates start_level in order to include 60 # pre-studies 57 self.assertEqual(studylevelsource.getTitle(studycourse, 620), 58 '500 (Year 5) 3rd spillover') 59 self.assertEqual(studylevelsource.getTitle(studycourse, 630), 60 'Error: level id 630 out of range') 61 self.assertEqual(studylevelsource.getTitle(studycourse, 700), 62 'Error: level id 700 out of range') 63 # Now we change the certificates start_level to pre-studies 61 64 studycourse.certificate.start_level = 10 62 self.assert True(studylevelsource.getTitle(studycourse, 10),65 self.assertEqual(studylevelsource.getTitle(studycourse, 10), 63 66 'Pre-Studies') 67 # Repeating Pre-Studies level does not exist 68 self.assertRaises(KeyError,studylevelsource.getTitle,studycourse,20) -
main/waeup.sirp/trunk/src/waeup/sirp/students/vocabularies.py
r7620 r7625 40 40 start_level = int(studycourse.certificate.start_level) 41 41 end_level = int(studycourse.certificate.end_level) 42 if start_level == 10: 43 levels = [10,] + [level for level in range(100,end_level+200,10) 44 if level % 100 < 30] 45 else: 46 levels = [level for level in range(start_level,end_level+200,10) 47 if level % 100 < 30] 42 48 else: 43 start_level = 10 44 end_level = 800 45 levels = [level for level in range(start_level,end_level+200,10) 46 if level % 100 < 30 and level < end_level + 120] 49 # default level range 50 levels = [level for level in range(100,800,10) if level % 100 < 30] 47 51 return levels 48 52 … … 66 70 end_level = int(context.certificate.end_level) 67 71 else: 68 start_level = 10 69 end_level = 800 70 if value < start_level or value > end_level + 110: 72 # default level range 73 start_level = 100 74 end_level = 600 75 if value < start_level or value > end_level + 120: 71 76 return "Error: level id %s out of range" % value 77 # Special treatment for pre-studies level 72 78 if value == 10: 73 79 return course_levels.by_value[value].title … … 76 82 repeat = repeat//10 77 83 title = course_levels.by_value[level].title 78 if level > end_level and repeat :84 if level > end_level and repeat == 1: 79 85 title = course_levels.by_value[level - 100].title 80 86 return "%s 2nd spillover" % title 87 if level > end_level and repeat == 2: 88 title = course_levels.by_value[level - 100].title 89 return "%s 3rd spillover" % title 81 90 if level > end_level: 82 91 title = course_levels.by_value[level - 100].title 83 return "%s spillover" % title 84 if repeat: 85 return "%s on %d. probation" % (title, repeat) 92 return "%s 1st spillover" % title 93 if repeat == 1: 94 return "%s on 1st probation" % title 95 if repeat == 2: 96 return "%s on 2nd probation" % title 86 97 return title 87 98
Note: See TracChangeset for help on using the changeset viewer.