Comment 2 for bug 1099331

Revision history for this message
Anthony Lenton (elachuni) wrote : Re: Date range results in 500 error message (Internal Server Error)

Grepping for the reported app, I found a bunch of oops reports that are probably the user's issue. On vanadium,
/srv/admin.ca.canonical.com/ca-logs/rangpur/sca/www-oops/2013-01-11/80915.770 matches
/srv/admin.ca.canonical.com/ca-logs/rangpur/sca/www-oops/2013-01-11/80925.770
/srv/admin.ca.canonical.com/ca-logs/rangpur/sca/www-oops/2013-01-11/80940.771
/srv/admin.ca.canonical.com/ca-logs/rangpur/sca/www-oops/2013-01-11/80959.771
/srv/admin.ca.canonical.com/ca-logs/rangpur/sca/www-oops/2013-01-11/80973.772
/srv/admin.ca.canonical.com/ca-logs/rangpur/sca/www-oops/2013-01-11/81256.773
/srv/admin.ca.canonical.com/ca-logs/seko/sca/www-oops/2013-01-30/13919.8

They all seem to have the same traceback:

https://myapps.developer.ubuntu.com/dev/apps/1682/stats/?start=2013-01-30&finish=2012-12-18&submit=Update

File "/usr/lib/python2.7/dist-packages/django/core/handlers/base.py", line 111, in get_response
    response = callback(request, *callback_args, **callback_kwargs)
  File "/usr/lib/python2.7/dist-packages/django/views/decorators/cache.py", line 79, in _wrapped_view_func
    response = view_func(request, *args, **kwargs)
  File "/srv/sc.ubuntu.com/production/software-center-agent/src/devportal/decorators.py", line 122, in inner_decorator
    request, application, *args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/django/contrib/auth/decorators.py", line 23, in _wrapped_view
    return view_func(request, *args, **kwargs)
  File "/srv/sc.ubuntu.com/production/software-center-agent/src/devportal/decorators.py", line 109, in check_non_arb_request
    return func(request, *args, **kwargs)
  File "/srv/sc.ubuntu.com/production/software-center-agent/src/devportal/views.py", line 439, in application_stats
    distrostats = app.stats.sales_by_distroseries(start=start, finish=finish)
  File "/srv/sc.ubuntu.com/production/software-center-agent/src/softwarecenteragent/stats.py", line 216, in sales_by_distroseries
    self.GROUP_BY_DAY)
  File "/srv/sc.ubuntu.com/production/software-center-agent/src/softwarecenteragent/stats.py", line 147, in queryset_for_date_series
    start = date_series[0]
IndexError: list index out of range

The finish date is greater than the start date, and sca is tripping over this. It should instead display an error message saying "The requested finish date must be later than start date", and ideally restrict the date picker client side to help the user select correct time intervals, though this might not be easy as we're re-using Django's admin date picker