Skip to content

Commit

Permalink
fixes bug 960093 - report list graph & table unchanged by date range,…
Browse files Browse the repository at this point in the history
… r=rhelmer
  • Loading branch information
peterbe committed Jan 24, 2014
1 parent 4d5cb2c commit 5a71286
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 8 deletions.
4 changes: 2 additions & 2 deletions webapp-django/crashstats/crashstats/models.py
Expand Up @@ -1337,8 +1337,8 @@ class CrashesFrequency(SocorroMiddleware):

possible_params = (
('products', list),
('from', datetime.datetime),
('to', datetime.datetime),
('from', datetime.date),
('to', datetime.date),
('versions', list),
('os', list),
('reasons', list),
Expand Down
12 changes: 11 additions & 1 deletion webapp-django/crashstats/crashstats/tests/test_views.py
Expand Up @@ -4153,6 +4153,15 @@ def mocked_post(url, **options):
def test_report_list_partial_graph(self, rget):

def mocked_get(url, **options):
today = datetime.datetime.utcnow().date()
# because when calling the .get() we use
# ?range_value=3&range_unit=days
# we expect /from/<3 days ago>
# and /to/<today>
# both in the URL
then = today - datetime.timedelta(days=3)
ok_('/from/%s/' % then.strftime('%Y-%m-%d'))
ok_('/to/%s/' % today.strftime('%Y-%m-%d'))
if '/crashes/frequency' in url:
# these fixtures make sure we stress the possibility that
# the build_date might be invalid or simply just null.
Expand Down Expand Up @@ -4207,7 +4216,8 @@ def mocked_get(url, **options):
url = reverse('crashstats.report_list_partial', args=('graph',))
response = self.client.get(url, {
'signature': 'sig',
'range_value': 3
'range_value': 3,
'range_unit': 'days'
})
eq_(response.status_code, 200)
expect_xaxis_ticks = [
Expand Down
13 changes: 8 additions & 5 deletions webapp-django/crashstats/crashstats/views.py
Expand Up @@ -1409,11 +1409,14 @@ def report_list(request, partial=None, default_context=None):
'XAXIS_TICKS': [],
}
crashes_frequency_api = models.CrashesFrequency()
builds = crashes_frequency_api.get(
signature=context['signature'],
products=[context['product']],
versions=versions
)['hits']
params = {
'signature': context['signature'],
'products': [context['product']],
'versions': versions,
'from': start_date.date(),
'to': end_date.date(),
}
builds = crashes_frequency_api.get(**params)['hits']

for i, build in enumerate(builds):
try:
Expand Down

0 comments on commit 5a71286

Please sign in to comment.