本文整理匯總了Python中result.Result.save方法的典型用法代碼示例。如果您正苦於以下問題:Python Result.save方法的具體用法?Python Result.save怎麽用?Python Result.save使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類result.Result
的用法示例。
在下文中一共展示了Result.save方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: create_result_set
# 需要導入模塊: from result import Result [as 別名]
# 或者: from result.Result import save [as 別名]
def create_result_set(self, reading_system, testsuite, user):
from result import Result
from score import Score, AccessibilityScore
from testsuite_app import helper_functions
last_updated = helper_functions.generate_timestamp()
result_set = ResultSet(reading_system = reading_system, testsuite=testsuite, last_updated = last_updated, user = user)
result_set.save()
print "Creating result set"
# create empty results for each test
tests = testsuite.get_tests()
for test in tests:
result = Result(result_set = result_set, test = test)
result.save()
# create empty scores for each category
categories = testsuite.get_categories()
for cat in categories:
if testsuite.testsuite_type == common.TESTSUITE_TYPE_DEFAULT:
score = Score(category = cat, result_set = result_set)
score.save()
else:
score = AccessibilityScore(category = cat, result_set = result_set)
score.save()
if testsuite.testsuite_type == common.TESTSUITE_TYPE_DEFAULT:
overall_score = Score(category = None, result_set = result_set)
overall_score.save()
else:
overall_score = AccessibilityScore(category = None, result_set = result_set)
overall_score.save()
result_set.visibility = reading_system.visibility
return result_set
示例2: create_evaluation
# 需要導入模塊: from result import Result [as 別名]
# 或者: from result.Result import save [as 別名]
def create_evaluation(self, reading_system):
"Create and return a new evaluation, along with an initialized set of result objects."
from test import Test
from score import Score
from result import Result
from category import Category
from testsuite import TestSuite
testsuite = TestSuite.objects.get_most_recent_testsuite()
print "Creating evaluation for testsuite {0}".format(testsuite.version_date)
tests = Test.objects.filter(testsuite = testsuite)
evaluation = self.create(
testsuite = testsuite,
last_updated = generate_timestamp(),
percent_complete = 0.00,
reading_system = reading_system
)
evaluation.save()
total_score = Score(category = None, evaluation = evaluation)
total_score.save()
# create results for this evaluation
for t in tests:
result = Result(test = t, evaluation = evaluation, result = RESULT_NOT_ANSWERED)
result.save()
# update the score once results have been created
total_score.update(evaluation.get_all_results())
# create category score entries for this evaluation
categories = Category.objects.filter(testsuite = evaluation.testsuite)
for cat in categories:
score = Score(
category = cat,
evaluation = evaluation
)
score.update(evaluation.get_category_results(cat))
score.save()
return evaluation