Ignore:
Timestamp:
30 Oct 2012, 20:19:06 (12 years ago)
Author:
Henrik Bettermann
Message:

Add converter for amounts and other things.

File:
1 edited

Legend:

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

    r9362 r9478  
    110110    'payment_date': 'date',
    111111    'validation_date': 'date',
     112    'resp_approved_amount': 'amount',
     113    'amount': 'amount',
     114    'amount_auth': 'amount',
     115    'surcharge': 'amount'
    112116    }
    113117
     
    236240        value = cls.old_new_id_map.get(value, value)
    237241        if len(value) == 7:
    238             return 'M' + value
     242            return 'B' + value
    239243        return value
    240244
     
    320324        # If real names are given, let's see if a similar value
    321325        # in LGAS exist.
     326        value = value.replace('_',' ')
    322327        value = LGAS_inverted_stripped.get(strip(lower), value)
    323328        return value
     
    432437
    433438    @classmethod
     439    def amount(self, value, row):
     440        """ Amounts must be integers
     441        """
     442        try:
     443            return float(value)
     444        except:
     445            return
     446
     447    @classmethod
    434448    def mode(self, value, row):
    435449        if value == "transfer_fulltime":
     
    483497        """
    484498        if not value:
     499            return
     500        if len(value) < 5:
    485501            return
    486502        value = value.strip('#')
     
    491507        if value.startswith('234'):
    492508            value = '+' + value[:3] + '-' + value[3:]
     509        elif value.startswith('+234'):
     510            value = value[:4] + '-' + value[4:]
    493511        else:
    494512            value = '-%s' % phone
     
    520538            header = convert_fieldnames(reader.fieldnames)
    521539            writer.writerow(header)
    522         if row.get('reg_state') == 'student_created':
    523             # We do not reimport student records which have never been accessed.
    524             continue
     540        #if row.get('reg_state') == 'student_created':
     541        #    # We do not reimport student records which have never been accessed.
     542        #    continue
    525543        if row.get('status') == 'started':
    526544            # We do not reimport started payments.
Note: See TracChangeset for help on using the changeset viewer.