Changeset 9795


Ignore:
Timestamp:
10 Dec 2012, 06:46:32 (12 years ago)
Author:
Henrik Bettermann
Message:

Add suspended students search.

Location:
main/waeup.kofa/trunk/src/waeup/kofa
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/src/waeup/kofa/applicants/browser.py

    r9771 r9795  
    674674            # Add log message to payments.log
    675675            self.context.logger.info(
    676                 '%s,%s,%s,%s,%s,,,,,,,,,,,,' % (
     676                '%s,%s,%s,%s,%s,,,,,,' % (
    677677                applicant.applicant_id,
    678678                self.context.p_id, self.context.p_category,
  • main/waeup.kofa/trunk/src/waeup/kofa/applicants/tests/test_browser.py

    r9771 r9795  
    815815        logcontent = open(logfile).read()
    816816        self.assertTrue(
    817             '"zope.mgr",%s,%s,application,200.0,AP,,,,,,,,,,,,\n'
     817            '"zope.mgr",%s,%s,application,200.0,AP,,,,,,\n'
    818818            % (self.applicant.applicant_id, payment.p_id)
    819819            in logcontent)
  • main/waeup.kofa/trunk/src/waeup/kofa/students/browser.py

    r9779 r9795  
    204204        form = self.request.form
    205205        self.hitlist = []
    206         if 'searchterm' in form and form['searchterm']:
     206        if form.get('searchtype', None) == 'suspended':
     207            self.searchtype = form['searchtype']
     208            self.searchterm = None
     209        elif 'searchterm' in form and form['searchterm']:
    207210            self.searchterm = form['searchterm']
    208211            self.searchtype = form['searchtype']
     
    244247        form = self.request.form
    245248        self.hitlist = []
    246         if 'searchterm' in form and form['searchterm']:
     249        if form.get('searchtype', None) == 'suspended':
     250            self.searchtype = form['searchtype']
     251            self.searchterm = None
     252        elif 'searchterm' in form and form['searchterm']:
    247253            self.searchterm = form['searchterm']
    248254            self.searchtype = form['searchtype']
  • main/waeup.kofa/trunk/src/waeup/kofa/students/browser_templates/containermanagepage.pt

    r7811 r9795  
    1313    <option i18n:translate="" value="depcode">in department</option>
    1414    <option i18n:translate="" value="current_mode">in study mode</option>
     15    <option i18n:translate="" value="suspended">
     16      with deactivated account (search term omitted)
     17    </option>
    1518  </select>
    1619
  • main/waeup.kofa/trunk/src/waeup/kofa/students/browser_templates/containerpage.pt

    r7811 r9795  
    1313    <option i18n:translate="" value="depcode">in department</option>
    1414    <option i18n:translate="" value="current_mode">in study mode</option>
     15    <option i18n:translate="" value="suspended">
     16      with deactivated account (search term omitted)
     17    </option>
    1518  </select>
    1619
  • main/waeup.kofa/trunk/src/waeup/kofa/students/catalog.py

    r9786 r9795  
    8080        results = Query().searchResults(
    8181            Text(('students_catalog', searchtype), query))
     82    elif searchtype == 'suspended':
     83        # 'suspended' is not indexed
     84        cat = queryUtility(ICatalog, name='students_catalog')
     85        all = cat.searchResults(student_id=(None, None))
     86        for student in all:
     87            if student.suspended:
     88                hitlist.append(StudentQueryResultItem(student, view=view))
     89        return hitlist
    8290    else:
    8391        # Temporary solution to display all students added
  • main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_browser.py

    r9770 r9795  
    368368        self.assertTrue('Anna Tester' in self.browser.contents)
    369369        # The old searchterm will be used again
     370        self.browser.getControl("Search").click()
     371        self.assertTrue('Anna Tester' in self.browser.contents)
     372
     373        # We can find suspended students
     374        self.student.suspended = True
     375        notify(grok.ObjectModifiedEvent(self.student))
     376        self.browser.open(self.manage_container_path)
     377        self.browser.getControl(name="searchtype").value = ['suspended']
     378        self.browser.getControl("Search").click()
     379        self.assertTrue('Anna Tester' in self.browser.contents)
     380        self.browser.open(self.container_path)
     381        self.browser.getControl(name="searchtype").value = ['suspended']
    370382        self.browser.getControl("Search").click()
    371383        self.assertTrue('Anna Tester' in self.browser.contents)
     
    845857        logcontent = open(logfile).read()
    846858        self.assertTrue(
    847             '"zope.mgr",K1000000,%s,schoolfee,40000.0,AP,,,,,,,,,,,,\n' % value
     859            '"zope.mgr",K1000000,%s,schoolfee,40000.0,AP,,,,,,\n' % value
    848860            in logcontent)
    849861
Note: See TracChangeset for help on using the changeset viewer.