Index: /WAeUP_SRP/trunk/WAeUPTool.py
===================================================================
--- /WAeUP_SRP/trunk/WAeUPTool.py	(revision 1400)
+++ /WAeUP_SRP/trunk/WAeUPTool.py	(revision 1401)
@@ -83,4 +83,10 @@
     ###)
 
+    security.declareProtected(ModifyPortalContent,'doCommit') ###(
+    def doCommit(self,logger=None):
+        "commit some transactions"
+        transaction.commit()
+    ###)
+
     security.declarePublic('loadStudentFoto') ###(
     def loadStudentFoto(self,student):
@@ -106,5 +112,4 @@
         return "successfully loaded passport picture"
     ###)
-
 
     security.declareProtected(ModifyPortalContent,'createOne') ###(
@@ -182,4 +187,14 @@
             student = res[0]
         logger.info('"%s", "creating Datastructure"' % student_id)
+        s_results = self.results_import(matric_no = st.matric_no)
+        lnr = self.getLevelFromResultsCosCode(s_results)
+        level = "%d00" % lnr
+        verdict,elegible = self.getVerdict(s_results[0].Verdict)
+        if elegible:
+            level = "%d00" % (lnr + 1)
+##        level = s_results[0].Level
+##        for result in s_results:
+##            if level != result.Level:
+##                logger.info('"%s", "Levels differ","%s != %s"' % (student_id,level,result.Level))
         #student should not be allowed to perform this transition
         #wftool = self.portal_workflow
@@ -191,5 +206,4 @@
             em = 'Certificate %s org-code %s not found\n' % (certcode, certcode_org)
             logger.info(em)
-        level = student.Level
         validlevel = False
         try:
@@ -223,5 +237,12 @@
         student_obj.invokeFactory('StudentPersonal','personal')
         da['jamb_reg_no'] = student.Entryregno
-        da['entry_mode'] = student.Mode_of_Entry
+        em = student.Mode_of_Entry
+        if em in ('DIRECT', 'DIRECT ENTRY',):
+            em = 'DE'
+        elif em in ('U.M.E', 'UNE',):
+            em = 'UME'
+        elif not em:
+            em = "unknown"
+        da['entry_mode'] = em
         personal = student_obj.personal
         self.portal_workflow.doActionFor(personal,'open',dest_container=personal)
@@ -260,4 +281,5 @@
         catd['sex'] = dp['sex']
         catd['level'] = level
+        catd['verdict'] = verdict
         if certificate_brain:
             cpath = certificate_brain.getPath().split('/')
@@ -274,4 +296,6 @@
         dsc = {}
         dsc['study_course'] = certcode
+        dsc['current_level'] = level
+        dsc['current_verdict'] = verdict
         studycourse.getContent().edit(mapping=dsc)
         #
Index: /WAeUP_SRP/trunk/profiles/default/schemas/schema.xsl
===================================================================
--- /WAeUP_SRP/trunk/profiles/default/schemas/schema.xsl	(revision 1400)
+++ /WAeUP_SRP/trunk/profiles/default/schemas/schema.xsl	(revision 1401)
@@ -13,4 +13,6 @@
         <table>
           <xsl:for-each select="object/field">
+            <xsl:sort select="@name"
+                      order="ascending" />
             <tr>
               <td colspan="">
Index: /WAeUP_SRP/trunk/profiles/default/schemas/student_study_course.xml
===================================================================
--- /WAeUP_SRP/trunk/profiles/default/schemas/student_study_course.xml	(revision 1400)
+++ /WAeUP_SRP/trunk/profiles/default/schemas/student_study_course.xml	(revision 1401)
@@ -7,3 +7,4 @@
   </field>
   <field name="current_level" meta_type="CPS String Field"/>
+  <field name="current_verdict" meta_type="CPS String Field"/>
 </object>
Index: /WAeUP_SRP/trunk/profiles/default/students_catalog.xml
===================================================================
--- /WAeUP_SRP/trunk/profiles/default/students_catalog.xml	(revision 1400)
+++ /WAeUP_SRP/trunk/profiles/default/students_catalog.xml	(revision 1401)
@@ -1,3 +1,4 @@
 <?xml version="1.0"?>
+<?xml-stylesheet type="text/xsl" href="catalog.xsl"?>
 <object name="portal_catalog" meta_type="WAeUP Table">
  <column value="id"/>
@@ -12,4 +13,5 @@
  <column value="phone"/>
  <column value="level"/>
+ <column value="verdict"/>
  <column value="entry_mode"/>
  <index name="id" meta_type="FieldIndex">
@@ -17,8 +19,8 @@
  </index>
  <index name="jamb_reg_no" meta_type="FieldIndex">
-  <indexed_attr value="jamb_reg_no"/>
+  <indexed_attr value="student_application:jamb_reg_no"/>
  </index>
  <index name="matric_no" meta_type="FieldIndex">
-  <indexed_attr value="matric_no"/>
+  <indexed_attr value="student_clearance:matric_no"/>
  </index>
  <index name="faculty" meta_type="KeywordIndex">
@@ -26,5 +28,5 @@
  </index>
  <index name="entry_mode" meta_type="KeywordIndex">
-  <indexed_attr value="entry_mode"/>
+  <indexed_attr value="student_application:entry_mode"/>
  </index>
  <index name="department" meta_type="KeywordIndex">
@@ -32,8 +34,11 @@
  </index>
  <index name="level" meta_type="KeywordIndex">
-  <indexed_attr value="level"/>
+  <indexed_attr value="student_study_course:current_level"/>
+ </index>
+ <index name="verdict" meta_type="KeywordIndex">
+  <indexed_attr value="student_study_course:current_verdict"/>
  </index>
  <index name="course" meta_type="KeywordIndex">
-  <indexed_attr value="course"/>
+  <indexed_attr value="student_study_course:study_course"/>
  </index>
 </object>
Index: /WAeUP_SRP/trunk/skins/waeup_pins/search_pins.py
===================================================================
--- /WAeUP_SRP/trunk/skins/waeup_pins/search_pins.py	(revision 1400)
+++ /WAeUP_SRP/trunk/skins/waeup_pins/search_pins.py	(revision 1401)
@@ -102,4 +102,5 @@
 info = {}
 info['used'] = []
+#from Products.zdb import set_trace;set_trace()
 if context.portal_type == "ScratchCardBatch":
     info['batch_doc'] = context.getContent() 
Index: /WAeUP_SRP/trunk/skins/waeup_student/getLevelFromResultsCosCode.py
===================================================================
--- /WAeUP_SRP/trunk/skins/waeup_student/getLevelFromResultsCosCode.py	(revision 1401)
+++ /WAeUP_SRP/trunk/skins/waeup_student/getLevelFromResultsCosCode.py	(revision 1401)
@@ -0,0 +1,19 @@
+## Script (Python) "getLevelFromResultsList"
+##bind container=container
+##bind context=context
+##bind namespace=
+##bind script=script
+##bind subpath=traverse_subpath
+##parameters=list
+##title=
+##
+# $Id$
+lnr = 0
+for e in list:
+    try:
+        cc = int(e.CosCode[3])
+    except:
+        continue
+    if lnr <= cc:
+        lnr = cc
+return lnr
Index: /WAeUP_SRP/trunk/skins/waeup_student/getVerdict.py
===================================================================
--- /WAeUP_SRP/trunk/skins/waeup_student/getVerdict.py	(revision 1401)
+++ /WAeUP_SRP/trunk/skins/waeup_student/getVerdict.py	(revision 1401)
@@ -0,0 +1,24 @@
+## Script (Python) "getVerdict"
+##bind container=container
+##bind context=context
+##bind namespace=
+##bind script=script
+##bind subpath=traverse_subpath
+##parameters=verdict
+##title=
+##
+# $Id$
+
+verdicts = {'SUCCESSFUL STUDENT': ('successful',True),
+            'STUDENT WITH CARRYOVER COURSES': ('carryover',True),
+            'STUDENT ON PROBATION': ('probation',False),
+            'WITHDRAWAL STUDENT': ('withdrawal',False),
+            'FIRST CLASS HONOURS': ('first_class',False),
+            'SECOND CLASS HONOURS (UPPER DIVISION)': ('second_class_upper',False),
+            'SECOND CLASS HONOURS (LOWER DIVISION)': ('second_class_lower',False),
+            'THIRD CLASS': ('third_class',False),
+#            '': ('',False),
+            }
+
+return verdicts.get(verdict,('no_such_verdict',False))
+
Index: /WAeUP_SRP/trunk/skins/waeup_utilities/fixLevelFromResults.py
===================================================================
--- /WAeUP_SRP/trunk/skins/waeup_utilities/fixLevelFromResults.py	(revision 1400)
+++ /WAeUP_SRP/trunk/skins/waeup_utilities/fixLevelFromResults.py	(revision 1401)
@@ -34,17 +34,13 @@
 
 
-
-
 if str(member) not in ('admin','joachim'):
     return
 count = 0
-lc = 1
+line_count = 0
 lines = []
 #from Products.zdb import set_trace;set_trace()
 res = scat()
 for sbrain in res:
-
     old_level = str(sbrain.level)
- 
     if str(sbrain.level) == '100':
         ec = "new"
@@ -52,15 +48,21 @@
         ec = "nor"
     erg = context.results_import(matric_no=sbrain.matric_no)
+    lc = 'u'
     if erg and erg[0].Level:
-        ec = "e"
+        lc = "e" # code for level status u = unset
         level = erg[0].Level
-        for e in erg:
-            ec = "E"
-            if level != e.Level:
-                ec = "%s:%s!=%s<br />\n" % (sbrain.matric_no,level,e.Level)
-        level = "%d" % (int(level) + 100)
-
-        context.students_catalog.modifyRecord(id = sbrain.id, level="")
-
+        everdict = erg[0].Verdict
+        lnr = context.getLevelFromResultsCosCode(erg)
+        if lnr == 0:
+            lc = "-"
+        if "%d00" % lnr != level:
+            lc = "!"
+        verdict,elegible = context.getVerdict(everdict)
+        if elegible:
+            lc = "+"
+            level = "%d00" % (lnr + 1)
+        context.students_catalog.modifyRecord(id = sbrain.id, 
+                                              level="",
+                                              verdict = "")
         while True:
             student = getattr(students,sbrain.id,None)
@@ -72,8 +74,9 @@
             if study_course is None:
                 break
-
-            study_course.getContent().edit(mapping = {'current_level':level})
-            context.students_catalog.modifyRecord(id = sbrain.id, level=level)
-
+            study_course.getContent().edit(mapping = {'current_level':level,
+                                                      'current_verdict':verdict})
+            context.students_catalog.modifyRecord(id = sbrain.id, 
+                                                  level=level,
+                                                  verdict=verdict)
             ec = "reg"
             break
@@ -81,5 +84,11 @@
 #        rwrite(ec +"--"+ sbrain.id +"--"+ sbrain.matric_no +"--"+ old_level +"--"+ level +"<br />")
 
-        lines.append('"%s","%s","%s","%s","%s"' % (ec,sbrain.id,sbrain.matric_no,old_level,level))
+        lines.append('"%s %s","%s","%s","%s","%s","%s","%s"' % (lc,ec,
+                                                           sbrain.id,
+                                                           sbrain.matric_no,
+                                                           old_level,
+                                                           level,
+                                                           everdict,
+                                                           verdict))
         
 
@@ -90,6 +99,6 @@
 #    count += 1
 #    if count > 60:
-#        lc += 1
-#        rwrite("<br />\n%3d " % lc)
+#        line_count += 1
+#        rwrite("<br />\n%3d " % line_count)
 #        count = 0
 
