How to use the result.Result.objects.filter function in result

To help you get started, we’ve selected a few result examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github IDPF / epubtestweb / testsuite-site / testsuite_app / models / evaluation.py View on Github external
def get_results(self, tests):
        "get a queryset of results for the given tests"
        from result import Result
        results = Result.objects.filter(test__in=tests, evaluation = self)
        return results
github IDPF / epubtestweb / testsuite-site / testsuite_app / models / evaluation.py View on Github external
def update_percent_complete(self):
        from result import Result
        all_results = self.get_all_results()
        if all_results.count() != 0:
            completed_results = Result.objects.filter(evaluation = self).exclude(result = RESULT_NOT_ANSWERED)
            pct_complete = (completed_results.count() * 1.0) / (len(all_results) * 1.0) * 100.0
            self.percent_complete = self.float_to_decimal(pct_complete)
            #self.percent_complete = (completed_results.count() * 1.0) / (len(all_results) * 1.0) * 100.0
        else:
            self.percent_complete = 0