Changeset 9007 for main/waeup.kofa/trunk


Ignore:
Timestamp:
17 Jul 2012, 04:36:27 (12 years ago)
Author:
Henrik Bettermann
Message:

Extend import file repair script.

Add shell script for downloading export files.

Location:
main/waeup.kofa/trunk/tools
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/tools/fix_import_file.py

    r8945 r9007  
    103103    'date': 'date',
    104104    'category': 'p_category',
     105    'reg_transition': 'reg_state',  # we completely change this column,
     106                                    # since reg_state import is usually intended
     107    'transition': 'reg_transition',
    105108    }
    106109
     
    109112    # base data
    110113    'reg_state': 'state',
     114    'reg_transition': 'state',
    111115    'jamb_reg_no': 'reg_number',
    112116    'matric_no': 'matric_number',
     
    165169    'courses_registered': 'courses registered',
    166170    'courses_validated': 'courses validated',
     171    'admit': 'admitted',
     172    'return': 'returning'
    167173    }
    168174
     
    193199        """
    194200        if len(value) == 7:
    195             return 'E' + value
     201            return 'B' + value
    196202        return value
    197203
     
    201207        """
    202208        return REGSTATE_MAPPING.get(value,value)
     209
     210    @classmethod
     211    def reg_transition(self, value):
     212        if value == "admitted":
     213            return "admit"
     214        if value == "returning":
     215            return "return"
     216        return value
    203217
    204218    @classmethod
     
    421435        if not value:
    422436            return
     437        value = value.strip('#')
    423438        value = value.replace('-', '')
    424439        value = value.replace('/', '')
    425440        match = RE_PHONE.match(value)
    426441        phone = match.groups()[0]
    427         value = '-%s' % phone
     442        if value.startswith('234'):
     443            value = '+' + value[:3] + '-' + value[3:]
     444        else:
     445            value = '-%s' % phone
    428446        return value + '#'
    429447
     
    437455            return [(i[0].lower(),i[1]) for i in liste]
    438456        return
     457
    439458
    440459def main():
Note: See TracChangeset for help on using the changeset viewer.