Commits

Caleb Smith committed 9556d73

Fixed to_date bumping in date_filter, and bumping back for redirects

  • Participants
  • Parent commits ec8ecdf

Comments (0)

Files changed (4)

timepiece/models.py

         user = self.user
         entries = user.timepiece_entries.filter(
             (Q(status='invoiced') | Q(status='approved')),
-            end_time__gt=date, end_time__lte=end_date)
+            end_time__gt=date, end_time__lt=end_date)
         data = {
             'billable': Decimal('0'), 'non_billable': Decimal('0'),
             'invoiced': Decimal('0'), 'uninvoiced': Decimal('0'),

timepiece/templatetags/timepiece_tags.py

             to_date = from_date
             use_range = False
             from_date = to_date - single_month
-            url = construct_url(from_date, to_date)
+            url = construct_url(from_date, to_date - relativedelta(days=1))
             filters['Past 12 Months'].append(
                 (from_date.strftime("%b '%y"), url))
         filters['Past 12 Months'].reverse()
         for x in range(12):
             to_date = from_date
             from_date = to_date - single_month
-            url = construct_url(from_date, to_date)
+            url = construct_url(from_date, to_date - relativedelta(days=1))
             filters['Past 12 Months'].append(
                 (from_date.strftime("%b '%y"), url))
         filters['Past 12 Months'].reverse()

timepiece/utils.py

         if request.GET:
             form = timepiece_forms.DateForm(request.GET)
             if form.is_valid():
-                from_date = form.cleaned_data.get('from_date')
-                to_date = form.cleaned_data.get('to_date')
-                form.save()
+                from_date, to_date = form.save()
                 status = form.cleaned_data.get('status')
                 activity = form.cleaned_data.get('activity')
             else:

timepiece/views.py

         and verified_count > 0 and total_statuses != 0
 
     summary = time_sheet.summary(window.date, window.end_date)
-
     context = {
         'show_verify': show_verify,
         'show_approve': show_approve,
             )
         if request.GET and form.cleaned_data.get('project'):
             entries = entries.filter(project=form.cleaned_data.get('project'))
+    to_date -= relativedelta(days=1)
     if action == 'invoice':
         return_url = reverse('invoice_projects',)
         get_str = urllib.urlencode({
             'from_date': from_date or '',
-            'to_date': to_date or '',
+            'to_date': to_date  or '',
         })
         return_url += '?%s' % get_str
     else:
         'form': form,
         'cals': cals,
         'project_totals': project_totals,
-        'to_date': to_date,
+        'to_date': to_date - relativedelta(days=1),
         'from_date': from_date,
         'unverified': unverified,
         'unapproved': unapproved,