Ignore:
Timestamp:
24 Feb 2022, 10:23:10 (3 years ago)
Author:
Henrik Bettermann
Message:

Improve export and reimport of previous study course data.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/src/waeup/kofa/students/export.py

    r16827 r16831  
    415415    """
    416416    grok.name('studentstudycourses')
    417 
    418     fields = tuple(sorted(iface_names(IStudentStudyCourse))) + ('student_id',)
     417    previous = 0
     418
     419    fields = tuple(sorted(iface_names(IStudentStudyCourse))) + (
     420        'student_id', 'previous')
    419421    title = _(u'Student Study Courses (Data Backup)')
    420422
     
    431433            student = context.student
    432434            value = getattr(student, name, None)
     435        if name == 'previous':
     436            return self.previous
    433437        return super(
    434438            StudentStudyCourseExporter, self).mangle_value(
     
    440444    """
    441445    grok.name('studentstudycourses_1')
    442 
     446    previous = 1
    443447    title = _(u'First Student Study Courses (Data Backup)')
    444448
     
    451455    """
    452456    grok.name('studentstudycourses_2')
    453 
     457    previous = 2
    454458    title = _(u'Second Student Study Courses (Data Backup)')
    455459
     
    465469    """
    466470    grok.name('studentstudylevels')
     471    previous = 0
    467472
    468473    fields = tuple(sorted(iface_names(
    469474        IStudentStudyLevel))) + (
    470         'student_id', 'number_of_tickets','certcode')
     475        'student_id', 'number_of_tickets','certcode', 'previous')
    471476    title = _(u'Student Study Levels (Data Backup)')
    472477
     
    480485            student = context.student
    481486            value = getattr(student, name, None)
     487        if name == 'previous':
     488            return self.previous
    482489        return super(
    483490            StudentStudyLevelExporter, self).mangle_value(
     
    489496    """
    490497    grok.name('studentstudylevels_1')
    491 
     498    previous = 1
    492499    title = _(u'First Course Student Study Levels (Data Backup)')
    493500
     
    500507    """
    501508    grok.name('studentstudylevels_2')
    502 
     509    previous = 2
    503510    title = _(u'Second Course Student Study Levels (Data Backup)')
    504511
     
    524531    fields = tuple(sorted(iface_names(ICourseTicket) +
    525532        ['level', 'code', 'level_session'])) + ('student_id',
    526         'certcode', 'display_fullname')
     533        'certcode', 'display_fullname', 'previous')
    527534    title = _(u'Course Tickets (Data Backup)')
     535    previous = 0
    528536
    529537    def filter_func(self, x, **kw):
     
    537545            if name in ('student_id', 'display_fullname') and student is not None:
    538546                value = getattr(student, name, None)
     547        if name == 'previous':
     548            return self.previous
    539549        return super(
    540550            CourseTicketExporter, self).mangle_value(
     
    546556    """
    547557    grok.name('coursetickets_1')
    548 
     558    previous = 1
    549559    title = _(u'First Course Course Tickets (Data Backup)')
    550560
     
    557567    """
    558568    grok.name('coursetickets_2')
    559 
     569    previous = 2
    560570    title = _(u'Second Course Course Tickets (Data Backup)')
    561571
Note: See TracChangeset for help on using the changeset viewer.