| OLD | NEW |
| 1 # Copyright 2016 The Chromium Authors. All rights reserved. | 1 # Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 from google.appengine.ext import ndb | 5 from google.appengine.ext import ndb |
| 6 | 6 |
| 7 from common.time_util import GetUTCNow | 7 from common.time_util import GetUTCNow |
| 8 from model.versioned_model import VersionedModel | 8 from model.versioned_model import VersionedModel |
| 9 | 9 |
| 10 | 10 |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 | 68 |
| 69 # Confidence score for CLs for test failures found by Try Job approach. | 69 # Confidence score for CLs for test failures found by Try Job approach. |
| 70 test_try_job = ndb.LocalStructuredProperty(ConfidenceInformation) | 70 test_try_job = ndb.LocalStructuredProperty(ConfidenceInformation) |
| 71 | 71 |
| 72 # Confidence score for CLs for test failures found by both approaches. | 72 # Confidence score for CLs for test failures found by both approaches. |
| 73 test_heuristic_try_job = ndb.LocalStructuredProperty(ConfidenceInformation) | 73 test_heuristic_try_job = ndb.LocalStructuredProperty(ConfidenceInformation) |
| 74 | 74 |
| 75 @classmethod | 75 @classmethod |
| 76 def Get(cls, version=None): | 76 def Get(cls, version=None): |
| 77 confidences = cls.GetVersion(version=version) | 77 confidences = cls.GetVersion(version=version) |
| 78 return (confidences or VersionedModel.Create() if version is None | 78 return (confidences or SuspectedCLConfidence.Create() if version is None |
| 79 else confidences) | 79 else confidences) |
| 80 | 80 |
| 81 def Update( | 81 def Update( |
| 82 self, start_date, end_date, | 82 self, start_date, end_date, |
| 83 compile_heuristic, compile_try_job, compile_heuristic_try_job, | 83 compile_heuristic, compile_try_job, compile_heuristic_try_job, |
| 84 test_heuristic, test_try_job, test_heuristic_try_job): | 84 test_heuristic, test_try_job, test_heuristic_try_job): |
| 85 | 85 |
| 86 self.start_date = start_date | 86 self.start_date = start_date |
| 87 self.end_date = end_date | 87 self.end_date = end_date |
| 88 self.updated_time = GetUTCNow() | 88 self.updated_time = GetUTCNow() |
| 89 self.compile_heuristic = compile_heuristic | 89 self.compile_heuristic = compile_heuristic |
| 90 self.compile_try_job = compile_try_job | 90 self.compile_try_job = compile_try_job |
| 91 self.compile_heuristic_try_job = compile_heuristic_try_job | 91 self.compile_heuristic_try_job = compile_heuristic_try_job |
| 92 self.test_heuristic = test_heuristic | 92 self.test_heuristic = test_heuristic |
| 93 self.test_try_job = test_try_job | 93 self.test_try_job = test_try_job |
| 94 self.test_heuristic_try_job = test_heuristic_try_job | 94 self.test_heuristic_try_job = test_heuristic_try_job |
| 95 | 95 |
| 96 if self.end_date <= end_date: | 96 self.Save() |
| 97 self.put() | |
| 98 else: | |
| 99 self.Save() | |
| OLD | NEW |