Skip to content

Commit

Permalink
bug 1212088 - blank out not needed columns
Browse files Browse the repository at this point in the history
  • Loading branch information
peterbe committed Oct 12, 2015
1 parent 7c9133f commit ad21007
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 17 deletions.
24 changes: 10 additions & 14 deletions socorro/external/postgresql/graphics_report.py
Expand Up @@ -62,9 +62,9 @@
SQL = """
SELECT
r.signature,
'URL (removed)' as url, -- 1
NULL as url, -- 1
'https://crash-stats.mozilla.com/report/index/' || r.uuid as uuid_url, -- 2
to_char(r.client_crash_date,'YYYYMMDDHH24MI') as client_crash_date, -- 3
NULL as client_crash_date, -- 3
to_char(r.date_processed,'YYYYMMDDHH24MI') as date_processed, -- 4
r.last_crash, -- 5
r.product, -- 6
Expand All @@ -78,25 +78,21 @@
array(select ba.bug_id from bug_associations ba where ba.signature = r.signature) as bug_list, --14
r.user_comments, --15
r.uptime as uptime_seconds, --16
'' as email, --17
(select sum(adi_count) from raw_adi adi
where adi.date = %(date)s
and r.product = adi.product_name and r.version = adi.product_version
and substring(r.os_name from 1 for 3) = substring(adi.product_os_platform from 1 for 3)
and r.os_version LIKE '%%'||adi.product_os_version||'%%') as adu_count, --18
r.topmost_filenames, --19
case when (r.addons_checked is NULL) then '[unknown]'when (r.addons_checked) then 'checked' else 'not' end as addons_checked, --20
r.flash_version, --21
NULL as email, --17
NULL as adu_count, --18
NULL as topmost_filenames, --19
NULL as addons_checked, --20
NULL as flash_version, --21
r.hangid, --22
r.reason, --23
r.process_type, --24
r.app_notes, --25
r.install_age, --26
rd.duplicate_of, --27
NULL as install_age, --26
NULL as duplicate_of, --27
r.release_channel, --28
r.productid --29
FROM
reports r left join reports_duplicates rd on r.uuid = rd.uuid
reports r
WHERE
r.date_processed BETWEEN %(yesterday)s AND %(date)s
AND r.product = %(product)s
Expand Down
14 changes: 11 additions & 3 deletions socorro/unittest/external/postgresql/test_graphics_report.py
Expand Up @@ -48,7 +48,7 @@ def setUpClass(cls):
'thunderbird'
);
""")
today = datetime.datetime.utcnow().date()
yesterday = datetime.datetime.utcnow() - datetime.timedelta(days=1)
cursor.execute("""
INSERT INTO reports
(id, signature, date_processed, uuid, product,
Expand Down Expand Up @@ -76,7 +76,11 @@ def setUpClass(cls):
NULL,
FALSE
);
""", (today, today))
""", (
yesterday,
# make one 1 minute later so we can test the sort order
yesterday + datetime.timedelta(seconds=60)
))

cls.connection.commit()

Expand All @@ -102,4 +106,8 @@ def test_get(self):
assert res['hits']
ok_(isinstance(res['hits'], list))
signatures = [x[0] for x in res['hits']]
eq_(signatures, ['my signature', 'signature'])
eq_(signatures, ['signature', 'my signature'])
date_processed = [x[4] for x in res['hits']]
# should be ordered ascending
first, second = date_processed
ok_(first < second)

0 comments on commit ad21007

Please sign in to comment.