def resolve_vulnerabilities(self,
                                info,
                                vuln_type='',
                                state='',
                                approval_status=''):
        """Resolve vulnerabilities attribute."""
        vulns_loader = info.context.loaders['vulnerability']
        vuln_filtered = vulns_loader.load(self.id)

        if vuln_type:
            vuln_filtered = vuln_filtered.then(lambda vulns: [
                vuln for vuln in vulns if vuln.vuln_type == vuln_type and
                (vuln.current_approval_status != 'PENDING' or vuln.
                 last_approved_status)
            ])
        if state:
            vuln_filtered = vuln_filtered.then(lambda vulns: [
                vuln for vuln in vulns if vuln_domain.get_current_state(vuln)
                == state and (vuln.current_approval_status != 'PENDING' or vuln
                              .last_approved_status)
            ])
        if approval_status:
            vuln_filtered = vuln_filtered.then(lambda vulns: [
                vuln for vuln in vulns
                if vuln.current_approval_status == approval_status
            ])

        return vuln_filtered
    def resolve_closed_vulnerabilities(self, info):
        """Resolve closed vulnerabilities attribute."""
        vulns_loader = info.context.loaders['vulnerability']
        vulns = vulns_loader.load(self.id)

        self.closed_vulnerabilities = vulns.then(lambda vulns: len([
            vuln for vuln in vulns if vuln_domain.get_current_state(vuln) ==
            'closed' and (vuln.current_approval_status != 'PENDING' or vuln.
                          last_approved_status)
        ]))

        return self.closed_vulnerabilities
    def resolve_closed_vulnerabilities(self, info):
        """Resolve closed vulnerabilities attribute."""
        finding_ids = finding_domain.filter_deleted_findings(
            project_domain.list_findings(self.name))
        vulns_loader = info.context.loaders['vulnerability']

        self.closed_vulnerabilities = vulns_loader.load_many(finding_ids).then(
            lambda findings: sum([
                len([vuln for vuln in vulns
                     if vuln_domain.get_current_state(vuln) == 'closed' and
                     (vuln.current_approval_status != 'PENDING' or
                      vuln.last_approved_status)])
                for vulns in findings
            ]))

        return self.closed_vulnerabilities