Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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
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