Ignore:
Timestamp:
23 Jan 2017, 15:58:02 (8 years ago)
Author:
Henrik Bettermann
Message:

Get set of selected students also from list of matric numbers.

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

Legend:

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

    r14373 r14443  
    441.4.2.dev0 (unreleased)
    55=======================
     6
     7* Get set of selected students also from list of matric numbers.
     8
     9* Confine Level Reports and Session Results Presentations to certificates.
    610
    711* Show report number (job_id) on report pdf slips.
  • main/waeup.kofa/trunk/src/waeup/kofa/students/browser_templates/exportselected.pt

    r12518 r14443  
    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. The ids must be separated by whitespaces or commas.
     3  a list of student ids or matric numbers.
     4  The values must be separated by whitespaces or commas.
    45  You can also copy and paste parts of Excel or Calc columns.
    56</p>
  • main/waeup.kofa/trunk/src/waeup/kofa/students/export.py

    r14395 r14443  
    223223        for id in selected:
    224224            student = students_container.get(id, None)
    225             if student:
    226                 students.append(student)
     225            if student is None:
     226                # try matric number
     227                result = list(StudentsQuery(matric_number=id).query())
     228                if result:
     229                    student = result[0]
     230                else:
     231                    continue
     232            students.append(student)
    227233        return students
    228234
  • main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_export.py

    r14366 r14443  
    422422        return
    423423
    424     def test_export_selected(self):
     424    def test_export_selected_student_id(self):
    425425        # we can export a filtered set of students (filtered by session/level)
    426426        self.setup_student(self.student)
     
    430430        exporter.export_selected(
    431431            self.app, self.outfile, selected=['A111111'])
     432        result = open(self.outfile, 'rb').read()
     433        self.assertEqual(
     434            result,
     435            'certificate,current_level,current_session,current_verdict,'
     436            'entry_mode,entry_session,previous_verdict,student_id\r\n'
     437
     438            'CERT1,200,2012,0,ug_ft,2010,0,A111111\r\n'
     439            )
     440        return
     441
     442    def test_export_selected_matric_number(self):
     443        # we can export a filtered set of students (filtered by session/level)
     444        self.setup_student(self.student)
     445        self.app['students'].addStudent(self.student)
     446        notify(grok.ObjectModifiedEvent(self.student))
     447        exporter = StudentStudyCourseExporter()
     448        exporter.export_selected(
     449            self.app, self.outfile, selected=['234'])
    432450        result = open(self.outfile, 'rb').read()
    433451        self.assertEqual(
Note: See TracChangeset for help on using the changeset viewer.