diff options
author | diosmosis <benaka@piwik.pro> | 2015-06-22 12:33:32 +0300 |
---|---|---|
committer | diosmosis <benaka@piwik.pro> | 2015-06-22 12:33:32 +0300 |
commit | 9f755bc0dc7e1a76e5692f9fca86bc0d4535c5ec (patch) | |
tree | d850d4ff318e05774864709791ff323dbdc5f43e /plugins/UserCountryMap | |
parent | 9480a9b15e466c455631d3935fb6dc97cdeafd18 (diff) |
Fix regression in API.getProcessedReport, it should not format metrics if showRawMetrics is true. And correctly fdisplay and format avg_time_on_site using processed metric value, instead of recalculating in visitor map.
Diffstat (limited to 'plugins/UserCountryMap')
-rw-r--r-- | plugins/UserCountryMap/javascripts/visitor-map.js | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/plugins/UserCountryMap/javascripts/visitor-map.js b/plugins/UserCountryMap/javascripts/visitor-map.js index 9305fe4a95..70d5aba3a8 100644 --- a/plugins/UserCountryMap/javascripts/visitor-map.js +++ b/plugins/UserCountryMap/javascripts/visitor-map.js @@ -155,14 +155,16 @@ var val = data[metric] % 1 === 0 || Number(data[metric]) != data[metric] ? data[metric] : data[metric].toFixed(1); if (metric == 'bounce_rate') { val += '%'; + } else if (metric == 'avg_time_on_site') { + val = new Date(0, 0, 0, val / 3600, val % 3600 / 60, val % 60) + .toTimeString() + .replace(/.*(\d{2}:\d{2}:\d{2}).*/, "$1"); } var v = _[metric].replace('%s', '<strong>' + val + '</strong>'); if (val == 1 && metric == 'nb_visits') v = _.one_visit; - function avgTime(d) { return d['sum_visit_length'] / d['nb_visits']; } - if (metric.substr(0, 3) == 'nb_' && metric != 'nb_actions_per_visit') { var total; if (id.length == 3) total = UserCountryMap.countriesByIso[id][metric]; @@ -606,8 +608,6 @@ function quantify(d, metric) { if (!metric) metric = $$('.userCountryMapSelectMetrics').val(); switch (metric) { - case 'avg_time_on_site': - return d.sum_visit_length / d.nb_visits; default: return d[metric]; } |