Exemplo n.º 1
0
    def get_context_data(self, **kwargs):
        if not JobAccess(self.request.user, self.object.decision.job).can_view:
            raise BridgeException(code=400)
        context = super().get_context_data(**kwargs)
        context.update({
            'report':
            self.object,
            'resources':
            report_resources(self.request.user, self.object),
            'SelfAttrsData':
            self.object.attrs.order_by('id').values_list(
                'id', 'name', 'value', 'data'),
            'main_content':
            ArchiveFileContent(self.object, 'problem_description',
                               PROBLEM_DESC_FILE).content.decode('utf8'),
            'MarkTable':
            UnknownReportMarksTable(self.request.user, self.object,
                                    self.get_view(VIEW_TYPES[12]))
        })

        # Get parent coverage if exists and parent is verification report
        cov_obj = CoverageArchive.objects.filter(
            report_id=self.object.parent_id,
            report__verification=True).first()
        if cov_obj:
            context['coverage'] = LeafCoverageStatistics(cov_obj)

        if self.object.decision.weight == DECISION_WEIGHT[0][0]:
            context['parents'] = get_parents(self.object)
        return context
Exemplo n.º 2
0
    def get_context_data(self, **kwargs):
        if not JobAccess(self.request.user, self.object.decision.job).can_view:
            raise BridgeException(code=400)

        context = super().get_context_data(**kwargs)
        if self.object.decision.weight == DECISION_WEIGHT[0][0]:
            context['parents'] = get_parents(self.object)
        context.update({
            'report':
            self.object,
            'resources':
            report_resources(self.request.user, self.object),
            'SelfAttrsData':
            self.object.attrs.order_by('id').values_list(
                'id', 'name', 'value', 'data'),
            'MarkTable':
            SafeReportMarksTable(self.request.user, self.object,
                                 self.get_view(VIEW_TYPES[11]))
        })

        # Get parent coverage if exists
        cov_obj = CoverageArchive.objects.filter(
            report_id=self.object.parent_id).first()
        if cov_obj:
            context['coverage'] = LeafCoverageStatistics(cov_obj)

        return context
Exemplo n.º 3
0
    def get_context_data(self, **kwargs):
        if not JobAccess(self.request.user, self.object.decision.job).can_view:
            raise BridgeException(code=400)
        try:
            etv = GetETV(
                ArchiveFileContent(self.object, 'error_trace',
                                   ERROR_TRACE_FILE).content.decode('utf8'),
                self.request.user)
        except Exception as e:
            logger.exception(e)
            etv = None
        context = super().get_context_data(**kwargs)
        if self.object.decision.weight == DECISION_WEIGHT[0][0]:
            context['parents'] = get_parents(self.object)
        context['verifier_files_url'] = leaf_verifier_files_url(self.object)
        context.update({
            'include_jquery_ui':
            True,
            'report':
            self.object,
            'etv':
            etv,
            'SelfAttrsData':
            self.object.attrs.order_by('id').values_list(
                'id', 'name', 'value', 'data'),
            'MarkTable':
            UnsafeReportMarksTable(self.request.user, self.object,
                                   self.get_view(VIEW_TYPES[10])),
            'resources':
            report_resources(self.request.user, self.object)
        })

        # Get parent coverage if exists and parent is verification report
        cov_obj = CoverageArchive.objects.filter(
            report_id=self.object.parent_id,
            report__verification=True).first()
        if cov_obj:
            context['coverage'] = LeafCoverageStatistics(cov_obj)

        return context
Exemplo n.º 4
0
    def get_context_data(self, **kwargs):
        if not JobAccess(self.request.user, self.object.decision.job).can_view:
            raise BridgeException(code=400)
        if self.object.decision.weight == DECISION_WEIGHT[1][0]:
            raise BridgeException(
                _('Report pages for lightweight decisions are not available'))

        context = super().get_context_data(**kwargs)
        context.update({
            'report':
            self.object,
            'status':
            ReportStatus(self.object),
            'data':
            ReportData(self.object),
            'resources':
            report_resources(self.request.user, self.object),
            'SelfAttrsData':
            ReportAttrsTable(self.object),
            'parents':
            get_parents(self.object),
            'reportdata':
            ViewReportData(self.request.user, self.get_view(VIEW_TYPES[2]),
                           self.object),
            'images':
            ReportImage.objects.filter(report_id=self.object.pk).only(
                'id', 'title'),
            'TableData':
            ReportChildrenTable(self.request.user,
                                self.object,
                                self.get_view(VIEW_TYPES[3]),
                                page=self.request.GET.get('page', 1))
        })
        if self.object.verification:
            context['VerificationCoverage'] = VerificationCoverageStatistics(
                self.object)
        else:
            context['Coverage'] = ReportCoverageStatistics(self.object)
        return context