Ignore:
Timestamp:
8 Jul 2015, 05:22:18 (9 years ago)
Author:
Henrik Bettermann
Message:

Include 'end day' when searching for payments in a given period.

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

Legend:

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

    r13144 r13156  
    2020import os
    2121import grok
    22 from datetime import datetime
     22from datetime import datetime, timedelta
    2323from zope.component import getUtility
    2424from waeup.kofa.interfaces import (
     
    9999        tz = getUtility(IKofaUtils).tzinfo
    100100        payments_start = tz.localize(payments_start)
    101         payments_end = tz.localize(payments_end)
     101        payments_end = tz.localize(payments_end) + timedelta(days=1)
    102102        if p_state:
    103103            # Only paid or unpaid tickets in payment period are considered
  • main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_export.py

    r13103 r13156  
    849849            payments_start='nonsense', payments_end='nonsense')
    850850        # If they match the format they are ignored by get_filtered and the
    851         # exporter works properly
     851        # exporter works properly.
     852        # Attention: End day is included!
    852853        exporter.export_filtered(
    853854            self.app, self.outfile,
    854855            current_session=None, current_level=None,
    855             payments_start='01/04/2012', payments_end='02/04/2012')
     856            payments_start='01/04/2012', payments_end='01/04/2012')
    856857        result = open(self.outfile, 'rb').read()
    857858        self.assertEqual(
     
    865866            'r-code,,A111111,created,2012\r\n'
    866867            )
    867         # no results if payment_date is outside the given period
     868        # Payment date is 2012-04-01, 14:12:01.
     869        # No results if payment_date is outside the given period.
    868870        exporter.export_filtered(
    869871            self.app, self.outfile,
    870872            current_session=None, current_level=None,
    871             payments_start='31/03/2012', payments_end='01/04/2012')
     873            payments_start='30/03/2012', payments_end='31/03/2012')
    872874        result = open(self.outfile, 'rb').read()
    873875        self.assertEqual(
     
    888890            'r_code,r_desc,student_id,state,current_session\r\n'
    889891            )
    890         # no results if payment_date is not set
     892        # No results if payment_date is not set
    891893        self.payment.payment_date = None
    892894        exporter.export_filtered(
    893895            self.app, self.outfile,
    894896            current_session=None, current_level=None,
    895             payments_start='01/04/2012', payments_end='02/04/2012')
    896         result = open(self.outfile, 'rb').read()
    897        
     897            payments_start='31/03/2012', payments_end='02/04/2012')
     898        result = open(self.outfile, 'rb').read()
     899        self.assertEqual(
     900            result,
     901            'ac,amount_auth,creation_date,p_category,p_current,p_id,'
     902            'p_item,p_level,p_session,p_state,payment_date,r_amount_approved,'
     903            'r_code,r_desc,student_id,state,current_session\r\n'
     904            )
    898905        return
    899906
Note: See TracChangeset for help on using the changeset viewer.