Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions docs/topics/runbooks/localdev/test_statistics_dashboard.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,18 @@ Test the devhub statistics dashboard locally with bigquery credentials.

### Enable a local addon to read from bigquery dev database

Only a [subset of addons][enabled_dev_guids] in dev push data to bigquery. In order to read from bigquery
your local addon will need to use a matching `guid`.
Only a [subset of addons][enabled_dev_guids] in dev push data to bigquery. In order to read from bigquery your local addon will need to use a matching `guid`.

Open a django shell `make djshell` and run the following:

- pk: the database id of the addon you want to use
- guid: the guid from the [list][enabled_dev_guids] you want to use (e.g. `@contain-facebook`)

```python
addon = Addon.objects.get(pk=<pg>)
addon = Addon.objects.get(pk=<pk>)
addon.update(guid=<guid>)
addon.save()
addon.addonguid.guid = <guid>
addon.addonguid.save() # Need to trigger post-save to update hashed_guid.
```

### Run the statistics dashboard
Expand Down
66 changes: 0 additions & 66 deletions src/olympia/constants/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -403,72 +403,6 @@
# see validate_addon_name()
MOZILLA_TRADEMARK_SYMBOLS = ('mozilla', 'firefox')

# If you add/remove any sources, update the docs: /api/download_sources.html
# Note there are some additional sources here for historical/backwards compat.
DOWNLOAD_SOURCES_FULL = (
'addondetail',
'addon-detail-version',
'api',
'category',
'collection',
'creatured',
'developers',
'discovery-dependencies',
'discovery-upsell',
'discovery-video',
'email',
'find-replacement',
'fxcustomization',
'fxfirstrun',
'fxwhatsnew',
'homepagebrowse',
'homepagepromo',
'installservice',
'mostshared',
'oftenusedwith',
'prerelease-banner',
'recommended',
'rockyourfirefox',
'search',
'sharingapi',
'similarcollections',
'ss',
'userprofile',
'version-history',
'co-hc-sidebar',
'co-dp-sidebar',
'cb-hc-featured',
'cb-dl-featured',
'cb-hc-toprated',
'cb-dl-toprated',
'cb-hc-mostpopular',
'cb-dl-mostpopular',
'cb-hc-recentlyadded',
'cb-dl-recentlyadded',
'hp-btn-promo',
'hp-dl-promo',
'hp-hc-featured',
'hp-dl-featured',
'hp-hc-upandcoming',
'hp-dl-upandcoming',
'hp-hc-mostpopular',
'hp-dl-mostpopular',
'hp-contest-winners',
'dp-hc-oftenusedwith',
'dp-dl-oftenusedwith',
'dp-hc-othersby',
'dp-dl-othersby',
'dp-btn-primary',
'dp-btn-version',
'dp-btn-devchannel',
'dp-hc-dependencies',
'dp-dl-dependencies',
'dp-hc-upsell',
'dp-dl-upsell',
)

DOWNLOAD_SOURCES_PREFIX = ('external-', 'mozcom-', 'discovery-', 'cb-btn-', 'cb-dl-')

# Regexp for Firefox client IDs passed to our APIs, just to avoid sending
# garbage to underlying services.
VALID_CLIENT_ID = re.compile('^[a-zA-Z0-9]{64}$')
Expand Down
132 changes: 2 additions & 130 deletions static/js/stats/chart.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,23 +91,8 @@ const dayMsecs = 24 * 3600 * 1000;
locales: 'users',
os: 'users',
versions: 'users',
statuses: 'users',
users_created: 'users',
downloads: 'downloads',
sources: 'downloads',
contributions: 'currency',
revenue: 'currency',
reviews_created: 'reviews',
addons_in_use: 'addons',
addons_created: 'addons',
addons_updated: 'addons',
addons_downloaded: 'addons',
collections_created: 'collections',
subscribers: 'collections',
ratings: 'collections',
sales: 'sales',
refunds: 'refunds',
installs: 'installs',
countries: 'users',
contents: 'downloads',
mediums: 'downloads',
Expand Down Expand Up @@ -151,7 +136,7 @@ const dayMsecs = 24 * 3600 * 1000;
i,
field,
val,
is_overview = metric == 'overview' || metric == 'app_overview';
is_overview = metric == 'overview';

if (!(group in acceptedGroups)) {
group = 'day';
Expand Down Expand Up @@ -282,7 +267,7 @@ const dayMsecs = 24 * 3600 * 1000;
// Add offset to line up points and ticks on day grouping.
pointStart: start,
data: series[field],
visible: !(metric == 'contributions' && id != 'total'),
visible: true,
});
}

Expand Down Expand Up @@ -314,45 +299,6 @@ const dayMsecs = 24 * 3600 * 1000;
Highcharts.numberFormat(n, 0),
);
}
function addonsFormatter(n) {
return format(
ngettext('{0} add-on', '{0} add-ons', n),
Highcharts.numberFormat(n, 0),
);
}
function collectionsFormatter(n) {
return format(
ngettext('{0} collection', '{0} collections', n),
Highcharts.numberFormat(n, 0),
);
}
function reviewsFormatter(n) {
return format(
ngettext('{0} review', '{0} reviews', n),
Highcharts.numberFormat(n, 0),
);
}
function currencyFormatter(n) {
return '$' + Highcharts.numberFormat(n, 2);
}
function salesFormatter(n) {
return format(
ngettext('{0} sale', '{0} sales', n),
Highcharts.numberFormat(n, 0),
);
}
function refundsFormatter(n) {
return format(
ngettext('{0} refund', '{0} refunds', n),
Highcharts.numberFormat(n, 0),
);
}
function installsFormatter(n) {
return format(
ngettext('{0} install', '{0} installs', n),
Highcharts.numberFormat(n, 0),
);
}
function addEventData(s, date) {
var e = events[date];
if (e) {
Expand Down Expand Up @@ -381,21 +327,6 @@ const dayMsecs = 24 * 3600 * 1000;
}
return addEventData(ret, this.x);
};
} else if (metric == 'contributions') {
return function () {
var ret = '<b>' + xFormatter(this.x) + '</b>',
p;
for (var i = 0; i < this.points.length; i++) {
p = this.points[i];
ret += '<br>' + p.series.name + ': ';
if (p.series.options.yAxis > 0) {
ret += Highcharts.numberFormat(p.y, 0);
} else {
ret += currencyFormatter(p.y);
}
}
return addEventData(ret, this.x);
};
} else {
// Determine y-axis formatter.
switch (metricTypes[metric]) {
Expand All @@ -405,28 +336,6 @@ const dayMsecs = 24 * 3600 * 1000;
case 'downloads':
yFormatter = downloadFormatter;
break;
case 'currency':
case 'revenue':
yFormatter = currencyFormatter;
break;
case 'collections':
yFormatter = collectionsFormatter;
break;
case 'reviews':
yFormatter = reviewsFormatter;
break;
case 'addons':
yFormatter = addonsFormatter;
break;
case 'sales':
yFormatter = salesFormatter;
break;
case 'refunds':
yFormatter = refundsFormatter;
break;
case 'installs':
yFormatter = installsFormatter;
break;
}
return function () {
var ret =
Expand Down Expand Up @@ -489,43 +398,6 @@ const dayMsecs = 24 * 3600 * 1000;
}).yAxis = 1;
}
}
if (metric == 'contributions' && newConfig.series.length) {
_.extend(newConfig, {
yAxis: [
{
// Amount
title: {
text: gettext('Amount, in USD'),
},
labels: {
formatter: function () {
return Highcharts.numberFormat(this.value, 2);
},
},
min: 0,
},
{
// Number of Contributions
title: {
text: gettext('Number of Contributions'),
},
min: 0,
labels: {
formatter: function () {
return Highcharts.numberFormat(this.value, 0);
},
},
opposite: true,
},
],
tooltip: {
shared: true,
crosshairs: true,
},
});
// set Daily Users series to use the right yAxis.
newConfig.series[0].yAxis = 1;
}
newConfig.tooltip.formatter = tooltipFormatter;

function makeSiteEventHandler(e) {
Expand Down
Loading
Loading