<commit_before># Copyright (C) 2014 Linaro Limited
#
# Author: <NAME> <<EMAIL>>
#
# This file is part of Testmanager.
#
# Testmanager is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License version 3
# as published by the Free Software Foundation
#
# Testmanager is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with Testmanager.  If not, see <http://www.gnu.org/licenses/>.

from django.views.generic import TemplateView

from rest_framework.views import APIView
from rest_framework.response import Response

from testmanager.views import LoginRequiredMixin
from testmanager.testrunner.models import LavaJob, Tag
from testmanager.testrunner.serializers import BuildSerializer, TagSerializer, LavaJobSerializer


class Base(LoginRequiredMixin, TemplateView):
    template_name='testreporter/base.html'


class Report_View(LoginRequiredMixin, APIView):

    def get(self, request, tag_id, format=None):
        tag = Tag.objects.get(id=tag_id).prefetch_related('builds')
        lava_jobs = LavaJob.objects.filter(jenkins_build__in=tag.builds)

        return Response({
            "tag": TagSerializer(tag).data,
            "builds": BuildSerializer(tag.builds).data,
            "lava_jobs": LavaJobSerializer(lava_jobs).data,
        })<commit_msg>report fix<commit_after># Copyright (C) 2014 Linaro Limited
#
# Author: <NAME> <<EMAIL>>
#
# This file is part of Testmanager.
#
# Testmanager is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License version 3
# as published by the Free Software Foundation
#
# Testmanager is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with Testmanager.  If not, see <http://www.gnu.org/licenses/>.

from django.views.generic import TemplateView

from rest_framework.views import APIView
from rest_framework.response import Response

from testmanager.views import LoginRequiredMixin
from testmanager.testrunner.models import JenkinsBuild, LavaJob, Tag
from testmanager.testrunner.serializers import BuildSerializer, TagSerializer, LavaJobSerializer


class Base(LoginRequiredMixin, TemplateView):
    template_name='testreporter/base.html'


class Report_View(LoginRequiredMixin, APIView):

    def get(self, request, tag_id, format=None):

        tag = Tag.objects.get(id=tag_id)
        builds = JenkinsBuild.objects.filter(tags=tag)
        lava_jobs = LavaJob.objects.filter(jenkins_build__in=builds)

        return Response({
            "builds": BuildSerializer(builds).data,
            "tag": TagSerializer(tag).data,
            "lava_jobs": LavaJobSerializer(lava_jobs).data,
        })
{'fraction_non_alphanumeric': 0.0778405524168236, 'fraction_numerical': 0.003138731952291274, 'mean_word_length': 4.347315436241611, 'pattern_counts': {'":': 6, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '908761', 'n_tokens_mistral': 885, 'n_tokens_neox': 856, 'n_words': 310}