Index: /WAeUP_SRP/base/skins/waeup_student/getLevelsFromCourseResults.py
===================================================================
--- /WAeUP_SRP/base/skins/waeup_student/getLevelsFromCourseResults.py	(revision 3397)
+++ /WAeUP_SRP/base/skins/waeup_student/getLevelsFromCourseResults.py	(revision 3397)
@@ -0,0 +1,41 @@
+## Script (Python) "getLevelsFromCourseResults"
+##bind container=container
+##bind context=context
+##bind namespace=
+##bind script=script
+##bind subpath=traverse_subpath
+##parameters=student_id=None
+##title=
+##
+# $Id$
+"""
+return Info about the Students StudyCourse
+"""
+import DateTime
+from Products.AdvancedQuery import Eq, Between, Le,In
+
+mtool = context.portal_membership
+if mtool.isAnonymousUser():
+    return None
+
+try:
+    from Products.zdb import set_trace
+except:
+    def set_trace():
+        pass
+import logging
+logger = logging.getLogger('Skins.getLevelsFromCourseResults')
+request = context.REQUEST
+
+if student_id is None:
+    student_id = context.getStudentId()
+query = Eq('student_id',student_id)
+results = context.course_results.evalAdvancedQuery(query,(('level_id','desc'),))
+old_level = 'xxx'
+levels = []
+for result in results:
+    if result.level_id != old_level:
+        old_level = result.level_id 
+        levels += old_level,
+return levels
+
Index: /WAeUP_SRP/base/skins/waeup_utilities/ti_115fc_resolve.py
===================================================================
--- /WAeUP_SRP/base/skins/waeup_utilities/ti_115fc_resolve.py	(revision 3397)
+++ /WAeUP_SRP/base/skins/waeup_utilities/ti_115fc_resolve.py	(revision 3397)
@@ -0,0 +1,79 @@
+## Script (Python) "ti_115fc_resolve"
+##bind container=container
+##bind context=context
+##bind namespace=
+##bind script=script
+##bind subpath=traverse_subpath
+##parameters=
+##title=
+##
+# $Id$
+"""
+"""
+try:
+    from Products.zdb import set_trace
+except:
+    def set_trace():
+        pass
+
+mtool = context.portal_membership
+member = mtool.getAuthenticatedMember()
+if str(member) not in ('admin','joachim'):
+    return
+
+
+import logging
+import DateTime
+logger = logging.getLogger('Skins.ti_115fc_resolve')
+from Products.AdvancedQuery import Eq, Between, Le,In
+aq_students = context.students_catalog.evalAdvancedQuery
+aq_portal = context.portal_catalog_real.evalAdvancedQuery
+course_results = context.course_results
+aq_course_results = course_results.evalAdvancedQuery
+students_folder = context.portal_url.getPortalObject().campus.students
+
+request = context.REQUEST
+session = request.SESSION
+response = request.RESPONSE
+setheader = request.RESPONSE.setHeader
+def rwrite(s):
+    response.setHeader('Content-type','text/html; charset=ISO-8859-15')
+    response.write("%s<br>\n\r" % s)
+results = course_results()
+inconsistent = {}
+students = context.students_catalog()    
+total = len(students)
+logger.info('started for %d students' % total) 
+wrong_count = 0
+count = 0
+commit_after = 10000
+#set_trace()
+for student in students:
+    count += 1
+    if not count % commit_after:
+        logger.info('found %d wrong of %d searched total %d' % (wrong_count,count,total))
+    levels = context.getLevelsFromCourseResults(student.id)
+    for level in levels:
+        if int(level) % 100:
+            logger.info('%s invalid level in course_results %s' % (student.id,','.join(levels)))
+    study_course = getattr(getattr(students_folder,student.id),'study_course',None)
+    if study_course is None:
+        wrong_count += 1
+        logger.info('%s no study_course object but %s levels' % (student.id,','.join(levels)))
+        continue
+    existing_levels = study_course.objectIds() 
+    different = [l for l in levels if l not in existing_levels]
+    if different:
+        wrong_count += 1
+        logger.info("%s levels %s in course_results and %s existing levels %d of %d checked %d wrong" % (student.id,
+                                                                                                         ",".join(levels),
+                                                                                                         ",".join(existing_levels),
+                                                                                                         count,
+                                                                                                         total,
+                                                                                                         wrong_count,
+                                                                                                        ))
+        # if count > 10:
+        #     break
+        # set_trace()
+logger.info('found %d' % wrong_count)
+logger.info('finished')
