def aggregated_metrics(request): """The aggregated (all locales) kb metrics dashboard.""" today = date.today() locales = get_locales_by_visit(today - timedelta(days=30), today) return render(request, 'dashboards/aggregated_metrics.html', { 'locales_json': json.dumps(settings.SUMO_LANGUAGES), 'locales': locales })
def aggregated_metrics(request): """The aggregated (all locales) kb metrics dashboard.""" today = date.today() locales = get_locales_by_visit(today - timedelta(days=30), today) return render( request, "dashboards/aggregated_metrics.html", {"locales_json": json.dumps(settings.SUMO_LANGUAGES), "locales": locales}, )
def aggregated_metrics(request): """The aggregated (all locales) kb metrics dashboard.""" today = date.today() locales = get_locales_by_visit(today - timedelta(days=30), today) product = _get_product(request) return render( request, 'dashboards/aggregated_metrics.html', { 'locales_json': json.dumps(settings.SUMO_LANGUAGES), 'locales': locales, 'product': product, 'products': Product.objects.filter(visible=True), })
def test_get_locales_by_visit(self, visitors_by_locale): """Verify the result of get_locales_by_visit().""" visitors_by_locale.return_value = { 'de': 1674352, 'en-US': 9381226, 'es': 1226117, 'fr': 1075765, 'pt-BR': 788700, 'ru': 950564, } results = get_locales_by_visit(date(2013, 7, 1), date(2013, 8, 1)) eq_([('en-US', 9381226), ('de', 1674352), ('es', 1226117), ('fr', 1075765), ('ru', 950564), ('pt-BR', 788700)], results)
def test_get_locales_by_visit(self, visitors_by_locale): """Verify the result of get_locales_by_visit().""" visitors_by_locale.return_value = { "de": 1674352, "en-US": 9381226, "es": 1226117, "fr": 1075765, "pt-BR": 788700, "ru": 950564, } results = get_locales_by_visit(date(2013, 7, 1), date(2013, 8, 1)) eq_( [ ("en-US", 9381226), ("de", 1674352), ("es", 1226117), ("fr", 1075765), ("ru", 950564), ("pt-BR", 788700), ], results, )