Changeset 17640 for main/waeup.kofa


Ignore:
Timestamp:
13 Nov 2023, 08:46:45 (12 months ago)
Author:
Henrik Bettermann
Message:

Get set of selected students also from list of payment ids.

Location:
main/waeup.kofa/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/CHANGES.txt

    r17610 r17640  
    441.8.2.dev0 (unreleased)
    55=======================
     6
     7*  Get set of selected students also from list of payment ids.
    68
    79* Add logging messages before after creating students from applicants.
  • main/waeup.kofa/trunk/src/waeup/kofa/students/browser_templates/exportselected.pt

    r14452 r17640  
    11<p i18n:translate="">
    22  Here you can export student data for a small subset of students by entering
    3   a list of student ids or matric numbers.
     3  a list of student ids, matric numbers or ids of payments made by students.
    44  The values must be separated by whitespaces or commas.
    55  You can also copy and paste parts of Excel or Calc columns.
     
    1818  <br />
    1919  <label for="mode" i18n:translate="">
    20     Student Ids or Matric Numbers
     20    Student Ids, Matric Numbers or Payment Ids
    2121  </label>
    2222  <input name="students" type="text" class="form-control" id="students"
  • main/waeup.kofa/trunk/src/waeup/kofa/students/export.py

    r17557 r17640  
    2323from datetime import datetime, timedelta
    2424from zope.component import getUtility
     25from zope.catalog.interfaces import ICatalog
    2526from waeup.kofa.interfaces import (
    2627    IExtFileStore, IFileStoreNameChooser, IKofaUtils)
     
    302303                if result:
    303304                    student = result[0]
    304                 else:
    305                     continue
    306             students.append(student)
     305            if student is None:
     306                # try p_id (requested by AAUE)
     307                cat = getUtility(ICatalog, name='payments_catalog')
     308                results = list(cat.searchResults(p_id=(id, id)))
     309                if results:
     310                    # Check if payer is a student
     311                    student = getattr(results[0], 'student')
     312            if student is not None:
     313                students.append(student)
    307314        return students
    308315
  • main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_export.py

    r16831 r17640  
    525525        return
    526526
     527    def test_export_selected_pid(self):
     528        # we can export a filtered set of students (filtered by session/level)
     529        self.setup_student(self.student)
     530        self.app['students'].addStudent(self.student)
     531        notify(grok.ObjectModifiedEvent(self.student))
     532        exporter = StudentStudyCourseExporter()
     533        exporter.export_selected(
     534            self.app, self.outfile, selected=[self.payment.p_id])
     535        result = open(self.outfile, 'rb').read()
     536        self.assertEqual(
     537            result,
     538            'certificate,current_level,current_session,current_verdict,'
     539            'entry_mode,entry_session,previous_verdict,student_id,previous\r\n'
     540
     541            'CERT1,200,2012,0,ug_ft,2010,0,A111111,0\r\n'
     542            )
     543        return
     544
    527545class PreviousStudyCourseExporterTests(StudentImportExportSetup):
    528546
Note: See TracChangeset for help on using the changeset viewer.