Changeset 9aa0693 in indico


Ignore:
Timestamp:
03/01/12 15:23:21 (15 months ago)
Author:
Pedro Ferreira <jose.pedro.ferreira@…>
Branches:
master, hello-world-walkthrough, ipv6, v0.98-series, v0.98.2, v0.98.3, v0.99, 051b2622c51afb171a1dedb46a0df4fbb0cbd02e, d9941f8582b36b24821a11ea5ba16fda6a457fb1
Children:
474698
Parents:
8e7c18
Message:

[IMP] Date calculation in VSO

Location:
indico/MaKaC
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • indico/MaKaC/services/implementation/collaboration.py

    r1d5dc6 r9aa0693  
    312312                    except ValueError, e: 
    313313                        raise CollaborationException(_("Parameter 'fromDays' is not an integer"), inner = e) 
    314                     now = nowutc() 
    315                     diff = timedelta(hours = now.hour, minutes = now.minute, seconds = now.second) 
    316                     minKey = now - diff - timedelta(days = fromDays) 
     314                    midnight = nowutc().replace(hour=0, minute=0, second=0) 
     315                    minKey = midnight - timedelta(days = fromDays) 
    317316                if self._params['toDays']: 
    318317                    try: 
     
    320319                    except ValueError, e: 
    321320                        raise CollaborationException(_("Parameter 'toDays' is not an integer"), inner = e) 
    322                     now = nowutc() 
    323                     diff = timedelta(days = 1) - \ 
    324                            timedelta(hours = now.hour, minutes = now.minute, seconds = (now.second + 1)) 
    325                     maxKey = now + diff + timedelta(days = toDays) 
     321                    midnight_1 = nowutc().replace(hour=23, minute=59, second=59) 
     322                    maxKey = midnight_1 + timedelta(days = toDays) 
    326323 
    327324                self._minKey = minKey 
  • indico/MaKaC/webinterface/pages/collaboration.py

    re4d5a6 r9aa0693  
    123123                except ValueError, e: 
    124124                    raise CollaborationException(_("Parameter 'fromDays' is not an integer"), inner = e) 
    125                 now = nowutc() 
    126                 diff = timedelta(hours = now.hour, minutes = now.minute, seconds = now.second) 
    127                 minKey = now - diff - timedelta(days = fromDays) 
     125                midnight = nowutc().replace(hour=0, minute=0, second=0) 
     126                minKey = midnight - timedelta(days = fromDays) 
    128127            if self._queryParams['toDays']: 
    129128                try: 
     
    131130                except ValueError, e: 
    132131                    raise CollaborationException(_("Parameter 'toDays' is not an integer"), inner = e) 
    133                 now = nowutc() 
    134                 diff = timedelta(days = 1) - \ 
    135                         timedelta(hours = now.hour, minutes = now.minute, seconds = (now.second + 1)) 
    136                 maxKey = now + diff + timedelta(days = toDays) 
     132                midnight_1 = nowutc().replace(hour=23, minute=59, second=59) 
     133                maxKey = midnight_1 + timedelta(days = toDays) 
    137134 
    138135            if self._queryParams["conferenceId"]: 
Note: See TracChangeset for help on using the changeset viewer.