Ignore:
Timestamp:
12 Jun 2013, 10:16:01 (11 years ago)
Author:
Henrik Bettermann
Message:

DataForBursaryExporter?: Export only paid payment tickets.

Adjust tests.

Location:
main/waeup.kofa/trunk/src/waeup/kofa/students
Files:
3 edited

Legend:

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

    r10236 r10296  
    9696    return payments
    9797
     98def get_paid_payments(students):
     99    """Get all paid payments of `students`.
     100    """
     101    payments = []
     102    for student in students:
     103        for payment in student.get('payments', {}).values():
     104            if payment.p_state == 'paid':
     105                payments.append(payment)
     106    return payments
     107
    98108def get_bedtickets(students):
    99109    """Get all bedtickets of `students`.
     
    319329    grok.name('bursary')
    320330
     331    def filter_func(self, x, **kw):
     332        return get_paid_payments(x)
     333
    321334    #: Fieldnames considered by this exporter
    322335    fields = tuple(
  • main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_batching.py

    r10016 r10296  
    276276        payment.creation_date = datetime.datetime(2012, 4, 1, 13, 12, 1)
    277277        payment.p_id = 'my-id'
     278        payment.p_state = 'paid'
    278279        payment.ac = u'666'
    279280        payment.p_item = u'p-item'
     
    281282        payment.p_session = 2012
    282283        payment.payment_date = datetime.datetime(2012, 4, 1, 14, 12, 1)
     284        payment.amount_auth = 12.12
    283285        payment.r_amount_approved = 12.12
    284286        payment.r_code = u'r-code'
  • main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_export.py

    r10276 r10296  
    651651            'r_code,r_desc,student_id,state,current_session\r\n'
    652652
    653             '666,0.0,2012-04-01 13:12:01,schoolfee,1,my-id,'
    654             'p-item,100,2012,unpaid,2012-04-01 14:12:01,12.12,'
     653            '666,12.12,2012-04-01 13:12:01,schoolfee,1,my-id,'
     654            'p-item,100,2012,paid,2012-04-01 14:12:01,12.12,'
    655655            'r-code,,A111111,created,2012\r\n'
    656656            )
     
    670670            'r_code,r_desc,student_id,state,current_session\r\n'
    671671
    672             '666,0.0,2012-04-01 13:12:01,schoolfee,1,my-id,'
    673             'p-item,100,2012,unpaid,2012-04-01 14:12:01,12.12,'
     672            '666,12.12,2012-04-01 13:12:01,schoolfee,1,my-id,'
     673            'p-item,100,2012,paid,2012-04-01 14:12:01,12.12,'
    674674            'r-code,,A111111,created,2012\r\n'
    675675            )
     
    689689            'r_code,r_desc,student_id,state,current_session\r\n'
    690690
    691             '666,0.0,2012-04-01 13:12:01,schoolfee,1,my-id,'
    692             'p-item,100,2012,unpaid,2012-04-01 14:12:01,12.12,'
     691            '666,12.12,2012-04-01 13:12:01,schoolfee,1,my-id,'
     692            'p-item,100,2012,paid,2012-04-01 14:12:01,12.12,'
    693693            'r-code,,A111111,created,2012\r\n'
    694694            )
     
    711711            'r_code,r_desc,student_id,state,current_session\r\n'
    712712
    713             '666,0.0,2012-04-01 13:12:01,schoolfee,1,my-id,'
    714             'p-item,100,2012,unpaid,2012-04-01 14:12:01,12.12,'
     713            '666,12.12,2012-04-01 13:12:01,schoolfee,1,my-id,'
     714            'p-item,100,2012,paid,2012-04-01 14:12:01,12.12,'
    715715            'r-code,,A111111,created,2012\r\n'
    716716            )
     
    740740            'state,current_session,entry_session,entry_mode,faccode,depcode\r\n'
    741741
    742             '666,0.0,2012-04-01 13:12:01,schoolfee,1,my-id,p-item,100,2012,'
    743             'unpaid,2012-04-01 14:12:01,12.12,r-code,,A111111,234,'
     742            '666,12.12,2012-04-01 13:12:01,schoolfee,1,my-id,p-item,100,2012,'
     743            'paid,2012-04-01 14:12:01,12.12,r-code,,A111111,234,'
    744744            'Anna,M.,Tester,created,2012,2010,ug_ft,NA,NA\r\n'
    745745            )
     
    885885            '%s\r\n'
    886886            'A111111,234,Anna M. Tester,created,CERT1,NA,NA,0,200,2012,ug_ft,'
    887             ',,,,,,,,,\r\n' % year_range_str,
     887            ',,,,,,,,12.12,\r\n' % year_range_str,
    888888            result
    889889            )
     
    898898        payment.p_id = 'my-id'
    899899        payment.p_session = 2009
    900         payment.amount_auth = 12.12
     900        payment.amount_auth = 13.13
    901901        payment.p_state = u'paid'
    902902        self.student['payments']['my-2ndpayment'] = payment
     
    909909            'current_level,current_session,current_mode,'
    910910            '%s\r\nA111111,234,Anna M. Tester,created,CERT1,NA,NA,0,'
    911             '200,2012,ug_ft,,,,,,12.12,,,,\r\n' % year_range_str,
     911            '200,2012,ug_ft,,,,,,13.13,,,12.12,\r\n' % year_range_str,
    912912            result
    913913            )
Note: See TracChangeset for help on using the changeset viewer.