示例#1
0
文件: views.py 项目: shuhaowu/kitsune
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
    })
示例#2
0
文件: views.py 项目: tobbi/kitsune
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},
    )
示例#3
0
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),
        })
示例#4
0
    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)
示例#5
0
    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)
示例#6
0
文件: views.py 项目: rivaxel/kitsune
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),
        })
示例#7
0
    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,
        )