Skip to content

Commit

Permalink
Merge pull request #20 from fieg/set-datetime-trained
Browse files Browse the repository at this point in the history
set datetime trained when teaching
  • Loading branch information
fieg committed Jan 6, 2015
2 parents a3e2779 + a722782 commit b770d39
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,10 @@ protected function persistResult($input, $output, $confidence, $expected = null)
$classifyResult->setClassifier($this->classifierName);
$classifyResult->setExpected($expected);

if (null !== $expected) {
$classifyResult->setDatetimeTrained(new \DateTime());
}

// if we have an existing record, update it's score, otherwise insert
if ($existingClassifyResult = $this->doctrine->getRepository('FMClassificationBundle:ClassifyResult')->findOneByHash($classifyResult->getHash())) {
$existingClassifyResult->setOutput($output);
Expand Down Expand Up @@ -134,6 +138,8 @@ public function teach($input, $expected)
$classifyResult->incrementWeight();

$classifyResult->setScore(null);

$classifyResult->setDatetimeTrained(new \DateTime());
}

$this->doctrine->getManager()->flush($classifyResults);
Expand Down

0 comments on commit b770d39

Please sign in to comment.