Negative date range results in 500 error message

Bug #1099331 reported by Anthony Dillon
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Developer registration portal
In Progress
High
Anthony Lenton

Bug Description

Recieved email to <email address hidden>.

Hello,

In the developer portal (myapps.developer.ubuntu.com) when I view the metrics on my app (Listen)
everything loads correctly however if I try to put in a date range I get a 500 error message (Internal Server Error). I tried a few different date ranges but I still got the same error every time.

Thanks!
Billy Barrow.

Update: Apparently the failure happens when the user specifies negative date ranges (ie, the start date is later than the finish date). The server should display a polite error message instead of failing miserably.

Revision history for this message
Julien Funk (jaboing) wrote :

Anthony, can you please include the email address of the person who filed this defect? Perhaps also inform them that the defect is here so we can be in touch with them for more information if necessary.

Changed in developer-portal:
importance: Undecided → High
status: New → Confirmed
tags: added: u1-by-user u1-on-production
Julien Funk (jaboing)
Changed in developer-portal:
assignee: nobody → Anthony Lenton (elachuni)
Revision history for this message
Anthony Lenton (elachuni) wrote :

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

summary: - Date range results in 500 error message (Internal Server Error)
+ Negative date range results in 500 error message
description: updated
Changed in developer-portal:
status: Confirmed → In Progress
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.