Changeset 727 for WAeUP_SRP/trunk


Ignore:
Timestamp:
20 Oct 2006, 13:06:08 (18 years ago)
Author:
joachim
Message:

improved student import,
renamed layout/schema student_course_results to student_course_result

Location:
WAeUP_SRP/trunk
Files:
10 edited
2 moved

Legend:

Unmodified
Added
Removed
  • WAeUP_SRP/trunk/Students.py

    r725 r727  
    8484        certs = {}
    8585        for c in l:
    86             certs[c.id] = c.getObject()
     86            ca,ac,fa,dep_id,co,certcode = c.relative_path.split('/')
     87            cid = "%(dep_id)s_%(certcode)s" % vars()
     88            certs[cid] = c.getObject()
    8789        for student in students:
    8890            logger.info('processing "%(MatricNo)s","%(EntryRegNo)s","%(CurrentSession)s","%(StudentLevel)s","%(fullname)s","%(FirstName)s","%(MiddleName)s","%(Lastname)s","%(FormerSurname)s","%(Sex)s","%(Nationality)s","%(State)s","%(LGA)s","%(PermanentAddress)s","%(PermanentAddressCity)s","%(CampusAddress)s","%(PhoneNumber)s","%(Emailaddress)s","%(Mode)s","%(CourseMajor)s","%(Faculty)s","%(Dept)s"\n' % student)
     
    9597                continue
    9698            certcode = makeCertificateCode(student.get('CourseMajor'))
    97             if certcode not in certs.keys():
     99            dep_id = student.get('Dept')
     100            fac_id = student.get('Faculty')
     101            cid = "%(dep_id)s_%(certcode)s" % vars()
     102            if cid not in certs.keys():
    98103                em = 'Certificate with ID %s %s not found\n' % (certcode, student.get('CourseMajor'))
    99104                logger.info(em)
     
    101106                no_import.write('"%(MatricNo)s","%(EntryRegNo)s","%(CurrentSession)s","%(StudentLevel)s","%(fullname)s","%(FirstName)s","%(MiddleName)s","%(Lastname)s","%(FormerSurname)s","%(Sex)s","%(Nationality)s","%(State)s","%(LGA)s","%(PermanentAddress)s","%(PermanentAddressCity)s","%(CampusAddress)s","%(PhoneNumber)s","%(Emailaddress)s","%(Mode)s","%(CourseMajor)s","%(Faculty)s","%(Dept)s"\n' % student)
    102107                continue
     108            certificate_doc = certs[cid].getContent()
    103109            level = student.get('StudentLevel')
    104110            try:
     
    162168                studycourse = student_obj.study_course
    163169                dsc = {}
     170                from_certificate = ['title',
     171                                   'max_elect',
     172                                   'max_pass',
     173                                   'n_core',
     174                                   'nr_years',
     175                                   'probation_credits',
     176                                   'promotion_credits',
     177                                   'start_level',
     178                                  ]
     179                for f in from_certificate:
     180                    dsc[f] = getattr(certificate_doc,f)
     181                dsc['faculty'] = fac_id
     182                dsc['department'] = dep_id
    164183                dsc['study_course'] = certcode
    165                 dsc['department'] = student.get('Dept')
    166                 dsc['faculty'] = student.get('Faculty')
    167184                css = student.get('CurrentSession') or '2004-2005'
    168185                cs = int(css.split('-')[0]) - 2000
     
    206223            wftool.doActionFor(clearance,'close')
    207224            wftool.doActionFor(personal,'close')
     225            wftool.doActionFor(studycourse,'close_for_edit')
    208226        open("%s/import/pwlist-%s.csv" % (i_home,name),"w+").write('\n'.join(pwlist))
    209227        return self.REQUEST.RESPONSE.redirect("%s" % self.REQUEST.get('URL1'))
     
    217235        level_wf_actions["SUCCESSFUL STUDENT"] = "pass_A"
    218236        level_wf_actions["STUDENT WITH CARRYOVER COURSES"] = "pass_B"
    219         level_wf_actions["STUDENT FOR PROBATION"] = "pass_C"
    220         level_wf_actions["STUDENT ON PROBATION/TRANSFER"] = "pass_D"
     237        level_wf_actions["STUDENT FOR PROBATION"] = "probate_C"
     238        level_wf_actions["STUDENT ON PROBATION/TRANSFER"] = "reject_D"
    221239        import transaction
    222240        wftool = self.portal_workflow
     
    274292                no_import.write('"%(Matnumber)s","%(CosCode)s","%(Ansbook)s","%(CosStuatus)s","%(Session)s","%(Mat_Cos)s","%(Score)s","%(CarryLevel)s","%(Grade)s","%(Weight)s","%(Semster)s","%(Verdict)s","%(Level)s","%(id)s","%(GPA)s"\n' % result)
    275293                continue
     294            course_doc = courses[course].getContent()
    276295            temp_level = result.get('Level')
    277296            result['StudentId'] = sf.getId()
     
    285304                    no_import.write('"%(Matnumber)s","%(CosCode)s","%(Ansbook)s","%(CosStuatus)s","%(Session)s","%(Mat_Cos)s","%(Score)s","%(CarryLevel)s","%(Grade)s","%(Weight)s","%(Semster)s","%(Verdict)s","%(Level)s","%(id)s","%(GPA)s"\n' % result)
    286305                    continue
    287                 if level_changed:
     306                level_changed = True
     307                if 'dlev' in vars().keys():
    288308                    wftool.doActionFor(l,level_wf_actions[dlev['verdict']])
    289                 level_changed = True
    290309                level = temp_level
    291310                l = getattr(sc,level,None)
     
    302321            cr = getattr(l,course)
    303322            dcr = {}
     323            from_course = ['title',
     324                           'credits',
     325                           'passmark',
     326                           ]
     327            for f in from_course:
     328                dcr[f] = getattr(course_doc,f)
    304329            dlev = {}
    305330            dcr['ansbook'] = result.get('Ansbook')
  • WAeUP_SRP/trunk/profiles/default/layouts.xml

    r652 r727  
    1919 <object name="student_clearance" meta_type="CPS Layout"/>
    2020 <object name="student_clearance_fe" meta_type="CPS Layout"/>
    21  <object name="student_course_results" meta_type="CPS Layout"/>
     21 <object name="student_course_result" meta_type="CPS Layout"/>
    2222 <object name="student_personal" meta_type="CPS Layout"/>
    2323 <object name="student_personal_fe" meta_type="CPS Layout"/>
  • WAeUP_SRP/trunk/profiles/default/layouts/student_course_result.xml

    r724 r727  
    77 <property name="flexible_widgets"/>
    88 <property name="validate_values_expr"></property>
     9 <widget name="credits" meta_type="Int Widget">
     10  <property name="title">Credits</property>
     11  <property name="fields">
     12   <element value="credits"/>
     13  </property>
     14  <property name="label">Credits</property>
     15  <property name="label_edit">Credits</property>
     16  <property name="readonly_layout_modes"/>
     17    <property name="readonly_layout_modes">
     18      <element value="edit"/>
     19    </property>
     20  <property name="hidden_readonly_layout_modes"/>
     21 </widget>
     22 <widget name="passmark" meta_type="Int Widget">
     23  <property name="title">Passmark</property>
     24  <property name="fields">
     25   <element value="passmark"/>
     26  </property>
     27  <property name="is_required">True</property>
     28  <property name="label">Passmark</property>
     29  <property name="label_edit">Passmark</property>
     30    <property name="readonly_layout_modes">
     31      <element value="edit"/>
     32    </property>
     33  <property name="hidden_layout_modes"/>
     34  <property name="hidden_readonly_layout_modes"/>
     35 </widget>
     36 <widget name="title" meta_type="String Widget">
     37  <property name="title">Course Title</property>
     38  <property name="fields">
     39   <element value="title"/>
     40  </property>
     41  <property name="label">Course Title</property>
     42  <property name="label_edit">Course Title</property>
     43    <property name="readonly_layout_modes">
     44      <element value="edit"/>
     45    </property>
     46  <property name="hidden_layout_modes"/>
     47  <property name="hidden_readonly_layout_modes"/>
     48  <property name="display_width">60</property>
     49 </widget>
    950 <widget name="ansbook" meta_type="String Widget">
    1051  <property name="title">Ansbook</property>
     
    4081  <property name="hidden_readonly_layout_modes"/>
    4182 </widget>
    42  <widget name="gpa" meta_type="Float Widget">
    43   <property name="title">GPA</property>
    44   <property name="fields">
    45    <element value="gpa"/>
    46   </property>
    47   <property name="label">GPA</property>
    48   <property name="label_edit">GPA</property>
    49   <property name="readonly_layout_modes"/>
    50   <property name="hidden_layout_modes"/>
    51   <property name="hidden_readonly_layout_modes"/>
    52  </widget>
    5383 <widget name="grade" meta_type="String Widget">
    5484  <property name="title">Grade</property>
     
    6999  <property name="label">ID</property>
    70100  <property name="label_edit">ID</property>
    71   <property name="readonly_layout_modes"/>
     101    <property name="readonly_layout_modes">
     102      <element value="edit"/>
     103    </property>
    72104  <property name="hidden_layout_modes"/>
    73105  <property name="hidden_readonly_layout_modes"/>
     
    119151 <table>
    120152  <row>
     153   <cell name="title"/>
     154  </row>
     155  <row>
    121156   <cell name="semester"/>
     157  </row>
     158  <row>
     159   <cell name="credits"/>
     160  </row>
     161  <row>
     162   <cell name="passmark"/>
    122163  </row>
    123164  <row>
  • WAeUP_SRP/trunk/profiles/default/layouts/student_study_course.xml

    r723 r727  
    1818  <property name="hidden_layout_modes"/>
    1919  <property name="hidden_readonly_layout_modes"/>
     20 </widget>
     21 <widget name="end_level" meta_type="Select Widget">
     22  <property name="title">End Level</property>
     23  <property name="fields">
     24   <element value="end_level"/>
     25  </property>
     26  <property name="label">End Level</property>
     27  <property name="label_edit">End Level</property>
     28  <property name="readonly_layout_modes"/>
     29  <property name="hidden_layout_modes"/>
     30  <property name="hidden_readonly_layout_modes"/>
     31  <property name="vocabulary">courselevel</property>
     32 </widget>
     33 <widget name="max_elect" meta_type="String Widget">
     34  <property name="title">Max Elect</property>
     35  <property name="fields">
     36   <element value="max_elect"/>
     37  </property>
     38  <property name="label">Max Elect</property>
     39  <property name="label_edit">Max Elect</property>
     40  <property name="readonly_layout_modes"/>
     41  <property name="hidden_layout_modes"/>
     42  <property name="hidden_readonly_layout_modes"/>
     43 </widget>
     44 <widget name="max_load" meta_type="Int Widget">
     45  <property name="title">Maximum Load</property>
     46  <property name="fields">
     47   <element value="max_load"/>
     48  </property>
     49  <property name="is_required">True</property>
     50  <property name="label">Maximum Load</property>
     51  <property name="label_edit">Maximum Load</property>
     52  <property name="readonly_layout_modes"/>
     53  <property name="hidden_layout_modes"/>
     54  <property name="hidden_readonly_layout_modes"/>
     55 </widget>
     56 <widget name="max_pass" meta_type="Int Widget">
     57  <property name="title">Maximum Pass</property>
     58  <property name="fields">
     59   <element value="max_pass"/>
     60  </property>
     61  <property name="is_required">True</property>
     62  <property name="label">Maximum Pass</property>
     63  <property name="label_edit">Maximum Pass</property>
     64  <property name="readonly_layout_modes"/>
     65  <property name="hidden_layout_modes"/>
     66  <property name="hidden_readonly_layout_modes"/>
     67 </widget>
     68 <widget name="n_core" meta_type="Int Widget">
     69  <property name="title">NCore</property>
     70  <property name="fields">
     71   <element value="n_core"/>
     72  </property>
     73  <property name="label">NCore</property>
     74  <property name="label_edit">NCore</property>
     75  <property name="readonly_layout_modes"/>
     76  <property name="hidden_layout_modes"/>
     77  <property name="hidden_readonly_layout_modes"/>
     78 </widget>
     79 <widget name="nr_years" meta_type="Int Widget">
     80  <property name="title">Nr of Years</property>
     81  <property name="fields">
     82   <element value="nr_years"/>
     83  </property>
     84  <property name="label">Nr of Years</property>
     85  <property name="label_edit">Nr of Years</property>
     86  <property name="readonly_layout_modes"/>
     87  <property name="hidden_layout_modes"/>
     88  <property name="hidden_readonly_layout_modes"/>
     89 </widget>
     90 <widget name="probation_credits" meta_type="Int Widget">
     91  <property name="title">Probation  Credits</property>
     92  <property name="fields">
     93   <element value="probation_credits"/>
     94  </property>
     95  <property name="label">Probation  Credits</property>
     96  <property name="label_edit">Probation  Credits</property>
     97  <property name="readonly_layout_modes"/>
     98  <property name="hidden_layout_modes"/>
     99  <property name="hidden_readonly_layout_modes"/>
     100 </widget>
     101 <widget name="promotion_credits" meta_type="Int Widget">
     102  <property name="title">Promotion  Credits</property>
     103  <property name="fields">
     104   <element value="promotion_credits"/>
     105  </property>
     106  <property name="label">Promotion  Credits</property>
     107  <property name="label_edit">Promotion  Credits</property>
     108  <property name="readonly_layout_modes"/>
     109  <property name="hidden_layout_modes"/>
     110  <property name="hidden_readonly_layout_modes"/>
     111 </widget>
     112 <widget name="start_level" meta_type="Select Widget">
     113  <property name="title">Start Level</property>
     114  <property name="fields">
     115   <element value="start_level"/>
     116  </property>
     117  <property name="label">Start Level</property>
     118  <property name="label_edit">Start Level</property>
     119  <property name="readonly_layout_modes"/>
     120  <property name="hidden_layout_modes"/>
     121  <property name="hidden_readonly_layout_modes"/>
     122  <property name="vocabulary">courselevel</property>
     123 </widget>
     124 <widget name="end_level" meta_type="Select Widget">
     125  <property name="title">End Level</property>
     126  <property name="fields">
     127   <element value="end_level"/>
     128  </property>
     129  <property name="label">End Level</property>
     130  <property name="label_edit">End Level</property>
     131  <property name="readonly_layout_modes"/>
     132  <property name="hidden_layout_modes"/>
     133  <property name="hidden_readonly_layout_modes"/>
     134  <property name="vocabulary">courselevel</property>
    20135 </widget>
    21136 <widget name="department" meta_type="String Widget">
     
    53168   <cell name="department"/>
    54169  </row>
     170  <row>
     171   <cell name="start_level"/>
     172  </row>
     173  <row>
     174   <cell name="end_level"/>
     175  </row>
     176  <row>
     177   <cell name="max_pass"/>
     178  </row>
     179  <row>
     180   <cell name="max_load"/>
     181  </row>
     182  <row>
     183   <cell name="promotion_credits"/>
     184  </row>
     185  <row>
     186   <cell name="probation_credits"/>
     187  </row>
     188  <row>
     189   <cell name="nr_years"/>
     190  </row>
     191  <row>
     192   <cell name="n_core"/>
     193  </row>
     194  <row>
     195   <cell name="max_elect"/>
     196  </row>
    55197 </table>
    56198</object>
  • WAeUP_SRP/trunk/profiles/default/schemas.xml

    r652 r727  
    99 <object name="course" meta_type="CPS Schema"/>
    1010 <object name="course_results" meta_type="CPS Schema"/>
    11  <object name="student_course_results" meta_type="CPS Schema"/>
    1211 <object name="department" meta_type="CPS Schema"/>
    1312 <object name="faculty" meta_type="CPS Schema"/>
    1413 <object name="semester" meta_type="CPS Schema"/>
    1514 <object name="student" meta_type="CPS Schema"/>
    16  <object name="student_study_course" meta_type="CPS Schema"/>
    1715 <object name="scratch_card_batch" meta_type="CPS Schema"/>
     16 <object name="student_course_result" meta_type="CPS Schema"/>
    1817 <object name="student_accommodation" meta_type="CPS Schema"/>
    1918 <object name="student_accommodation_fe" meta_type="CPS Schema"/>
     
    2221 <object name="student_personal" meta_type="CPS Schema"/>
    2322 <object name="student_search" meta_type="CPS Schema"/>
     23 <object name="student_study_course" meta_type="CPS Schema"/>
    2424 <object name="students" meta_type="CPS Schema"/>
    2525 <object name="student_study_level" meta_type="CPS Schema"/>
  • WAeUP_SRP/trunk/profiles/default/schemas/student_course_result.xml

    r724 r727  
    11<?xml version="1.0"?>
    22<object name="course_results" meta_type="CPS Schema">
     3 <field name="title" meta_type="CPS String Field"/>
     4 <field name="faculty_code" meta_type="CPS String Field"/>
     5 <field name="department_code" meta_type="CPS String Field"/>
     6 <field name="credits" meta_type="CPS Int Field"/>
     7 <field name="passmark" meta_type="CPS Int Field"/>
    38 <field name="ansbook" meta_type="CPS String Field"/>
    49 <field name="carry_level" meta_type="CPS String Field"/>
    5  <field name="gpa" meta_type="CPS Float Field"/>
    610 <field name="grade" meta_type="CPS String Field"/>
    711 <field name="import_id" meta_type="CPS String Field"/>
  • WAeUP_SRP/trunk/profiles/default/schemas/student_study_course.xml

    r723 r727  
    11<?xml version="1.0"?>
    22<object name="student_study_course" meta_type="CPS Schema">
     3<field name="title" meta_type="CPS String Field"/>
    34<field name="study_course" meta_type="CPS String Field">
    45<property name="is_searchabletext">True</property>
     
    1011    <property name="is_searchabletext">True</property>
    1112</field>
     13 <field name="max_elect" meta_type="CPS String Field"/>
     14 <field name="max_load" meta_type="CPS Int Field"/>
     15 <field name="max_pass" meta_type="CPS Int Field"/>
     16 <field name="n_core" meta_type="CPS Int Field"/>
     17 <field name="nr_years" meta_type="CPS Int Field"/>
     18 <field name="probation_credits" meta_type="CPS Int Field"/>
     19 <field name="promotion_credits" meta_type="CPS Int Field"/>
     20 <field name="start_level" meta_type="CPS String Field"/>
     21 <field name="end_level" meta_type="CPS String Field"/>
    1222</object>
  • WAeUP_SRP/trunk/profiles/default/types/StudentCourseResult.xml

    r723 r727  
    1717 <property name="cps_display_as_document_in_listing">True</property>
    1818 <property name="schemas">
    19   <element value="student_course_results"/>
     19  <element value="student_course_result"/>
    2020 </property>
    2121 <property name="layouts">
    22   <element value="student_course_results"/>
     22  <element value="student_course_result"/>
    2323 </property>
    2424 <property name="layout_clusters"/>
  • WAeUP_SRP/trunk/profiles/default/vocabularies/searchable_student_states.xml

    r603 r727  
    1717 <item key="clearance_requested" msgid="">clearance requested</item>
    1818 <item key="cleared_and_validated" msgid="">cleared and validated</item>
     19 <item key="content_addable" msgid="">content addable</item>
     20 <item key="category_A" msgid="">category A</item>
     21 <item key="category_B" msgid="">category B</item>
     22 <item key="category_C" msgid="">category C</item>
     23 <item key="category_D" msgid="">category D</item>
     24 <item key="category_E" msgid="">category E</item>
     25 <item key="category_F" msgid="">category F</item>
    1926</object>
  • WAeUP_SRP/trunk/profiles/default/workflows/waeup_student_subobject_wf/definition.xml

    r723 r727  
    1010  <exit-transition transition_id="open"/>
    1111 </state>
     12 <state state_id="content_addable" title="">
     13  <exit-transition transition_id="close"/>
     14  <exit-transition transition_id="create_content"/>
     15  <exit-transition transition_id="open"/>
     16 </state>
    1217 <state state_id="created" title="">
    1318  <exit-transition transition_id="close"/>
     19  <exit-transition transition_id="close_for_edit"/>
    1420  <exit-transition transition_id="create_content"/>
    1521  <exit-transition transition_id="open"/>
     
    2531 <state state_id="opened" title="">
    2632  <exit-transition transition_id="close"/>
     33  <exit-transition transition_id="close_for_edit"/>
    2734  <exit-transition transition_id="create_content"/>
    2835  <permission-map name="Modify portal content"
     
    4653   <guard-role>SectionManager</guard-role>
    4754   <guard-role>Owner</guard-role>
     55  </guard>
     56 </transition>
     57 <transition transition_id="close_for_edit" title=""
     58             new_state="content_addable" trigger="USER"
     59             before_script="" after_script="">
     60 
     61  <guard>
    4862  </guard>
    4963 </transition>
  • WAeUP_SRP/trunk/skins/waeup_student/getStudyLevelInfo.py

    r725 r727  
    1 ## Script (Python) "cpsdocument_edit"
     1# Script (Python) "cpsdocument_edit"
    22##bind container=container
    33##bind context=context
     
    1212return Info about the Studylevel
    1313"""
    14 def findCourse(cid):
    15     ''' find the course'''
    16     res = context.portal_catalog({'meta_type': 'Course',
    17                                   'id': cid})
    18     if len(res) < 1:
    19         return None
    20     course = res[0].getObject().getContent()
    21     return course
    22 
    2314def calculateGPA():
    2415    """calculate the gpa"""
     
    7667    rd = ro.getContent()
    7768    row['id'] = ro.getId()
    78     course = findCourse(ro.getId())
    79     row['credits'] = 0
    80     if course:
    81         row['credits'] = course.credits
     69    row['credits'] = rd.credits
    8270    if row['credits'] and rd.grade:
    83         credits = int(course.credits)
     71        credits = int(rd.credits)
    8472        sum += credits * ['F','E','D','C','B','A'].index(rd.grade)
    8573        course_count += credits
    8674    row['sum'] = sum
    8775    row['count'] = course_count
    88     row['title'] = rd.Title()
     76    row['title'] = rd.title
    8977    #row['core'] = rd.core_or_elective
    9078    row['semester'] = rd.semester
  • WAeUP_SRP/trunk/skins/waeup_student/searchStudents.py

    r680 r727  
    1212return Info about the current Student
    1313"""
    14 #from Products.ZCTextIndex.QueryParser import ParseError,QueryError
     14try:
     15    from Products.AdvancedQuery import Eq, Between, Le
     16    evalAdvancedQuery = context.portal_catalog.evalAdvancedQuery
     17except:
     18    evalAdvancedQuery = None
     19   
    1520request = context.REQUEST
    1621form = request.form
     
    5358err = False
    5459with_review = state != "all"
     60onlyreview = with_review and not term
     61with_level_results = state.startswith("category") and evalAdvancedQuery is not None
     62bools = "with_review = %s<br\> onlyreview = %s<br\> with_level_results = %s" % (with_review,onlyreview,with_level_results)
    5563if not term and not with_review:
    5664    psm = "You must specify a search string when searching 'all states'."
     
    6674                             is_manager = is_manager,
    6775                             )
    68 with_review = state != "all"
    6976items = []
    7077res = []
    7178portal_type_query = {'query':['Student','StudentApplication','StudentPersonal']}
    7279st_queries = ('jamb_reg_no','matric_no','name')
    73 onlyreview = with_review and not term
    74 if onlyreview:
    75     res = catalog(portal_type='Student',
    76                   review_state=state)
     80query_step = 0
     81if onlyreview and not with_level_results:
     82    query_step = 1
     83    query =  Eq('portal_type','Student') & Eq('review_state',state)
     84    res = evalAdvancedQuery(query)
     85##    res = catalog(portal_type='Student',
     86##                  review_state=state)
     87elif onlyreview and with_level_results:
     88    query_step = 2
     89    query =  Eq('portal_type','StudentStudyLevel') & Eq('review_state',state)
     90    res = evalAdvancedQuery(query)
    7791elif what == "student_id":
    7892    if with_review:
     93        query_step = 3
    7994        res = catalog(portal_type='Student',
    8095                      id = term.strip(),
    8196                      review_state=state)
    8297    else:
     98        query_step = 4
    8399        res = catalog(portal_type='Student',
    84100                      id = term.strip())
    85 elif what in st_queries:
     101elif what in st_queries and not with_level_results:
    86102    if what == "jamb_reg_no":
     103        query_step = 5
    87104        pt = 'StudentApplication'
    88105        st = "%s*" % term.strip().lower()
    89106    elif what == "matric_no":
     107        query_step = 6
    90108        pt = 'StudentClearance'
    91109        st = "%s*" % term.strip().lower()
    92110    elif what == "name":
     111        query_step = 7
    93112        pt = portal_type_query
    94113        st = "%s*" % term.strip()
     
    102121                             is_manager = is_manager,
    103122                             )
     123elif what in st_queries and with_level_results and evalAdvancedQuery:
     124    if what == "jamb_reg_no":
     125        query_step = 8
     126        pt = 'StudentApplication'
     127        st = "%s*" % term.strip().lower()
     128    elif what == "matric_no":
     129        query_step = 9
     130        pt = 'StudentClearance'
     131        st = "%s*" % term.strip().lower()
     132    elif what == "name":
     133        query_step = 10
     134        pt = portal_type_query
     135        st = "%s*" % term.strip()
     136    query = Eq('portal_type',pt) & Eq('SearchableText',"%s*" % term.strip().lower())\
     137                | Eq('portal_type','StudentStudyLevel') & Eq('review_state',state)
     138    try:
     139        res = evalAdvancedQuery(query)
     140    except:
     141        return context.students_manager_view(rendered = rend,
     142                             psm = 'Advanced Query failed' % term,
     143                             #psm = "%s, %s" % (psm,ds),
     144                             students = items,
     145                             is_manager = is_manager,
     146                             )
    104147students = []
     148raw_res = len(res)
    105149if res:
    106150    for r in res:
    107         if r.portal_type in ("StudentApplication","StudentPersonal"):
     151        if r.portal_type in ("StudentApplication","StudentPersonal",):
    108152            student = r.getObject().aq_parent
     153        elif r.portal_type in ("StudentStudyLevel",):
     154            student = r.getObject().aq_parent.aq_parent
    109155##            pp = '/'.join(r.getPath().split('/')[:-1])
    110156##            student_cat = catalog(pathindex=pp,portal_type='Student')[0]
     
    114160            student = r.getObject()
    115161        student_rs = wf.getInfoFor(student,'review_state','keiner')
    116         if (with_review and student_rs != state) or student in items:
     162        if (with_review and student_rs != state and not with_level_results) or student in items:
    117163            continue
    118164        items.append(student)
     
    126172                             )
    127173return context.students_manager_view(rendered = rend,
    128                              psm = """Your search for "%s" in %s with state %s failed.""" % (st,what,state),
     174                             psm = """Step: %s found: %s Your search for "%s" in %s with state %s failed.<br\>%s""" % (query_step,raw_res,st,what,state,bools),
    129175                             students = students,
    130176                             is_manager = is_manager,
Note: See TracChangeset for help on using the changeset viewer.