Ignore:
Timestamp:
11 Feb 2020, 12:15:26 (5 years ago)
Author:
Henrik Bettermann
Message:

Add unlock_score field to CourseTicketProcessor and extend checkUpdateRequirements.

File:
1 edited

Legend:

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

    r15628 r16000  
    637637    Like all other student data importers, this processor also requires
    638638    either `student_id`, `reg_number` or `matric_number` to find the student.
    639     Then  it needs `level` and `code` to localize the course ticket.
     639    Then it needs `level` and `code` to localize the course ticket.
    640640
    641641    `checkConversion` first searches the courses catalog for the imported
     
    650650    nor by import. Other values can be overwritten by import.
    651651
    652     `ticket_session` is an additional attribute which can be used to store the
     652    `ticket_session` is an additional field which can be used to store the
    653653    session of the course when it was taken. Usually this information is
    654654    redundant because the parent study level object already contains this
    655655    information, except for the study level zero container which can be used to
    656656    store 'orphaned' course tickets.
     657
     658    `checkUpdateRequirements` ensures that the `score` attribute can't
     659    be accidentally overwritten by import in update mode. The `score`
     660    attribute can be unlocked by setting the boolean field
     661    `unlock_score` = 1.
    657662    """
    658663    grok.implements(IBatchProcessor)
     
    675680            'mandatory', 'score', 'carry_over', 'automatic',
    676681            'outstanding', 'course_category', 'level_session',
    677             'title', 'credits', 'passmark', 'semester', 'ticket_session'
     682            'title', 'credits', 'passmark', 'semester', 'ticket_session',
     683            'unlock_score'
    678684            ] + self.additional_fields
    679685        return sorted(fields)
     
    735741        if obj.student.studycourse_locked:
    736742            return 'Studycourse is locked.'
     743        if row.get('score',None) and obj.score and not row.get(
     744            'unlock_score',None):
     745            return 'Score attribute is locked.'
    737746        return None
    738747
Note: See TracChangeset for help on using the changeset viewer.