questtype ?Submit?: use database transaction for adding terms
This commit is contained in:
parent
f4980652c2
commit
794462e3e9
1 changed files with 36 additions and 26 deletions
|
|
@ -281,6 +281,8 @@
|
||||||
*/
|
*/
|
||||||
private function addTerms($submissionId, $terms)
|
private function addTerms($submissionId, $terms)
|
||||||
{
|
{
|
||||||
|
$this->db->setAutocommit(false);
|
||||||
|
try {
|
||||||
// Calculate IDF: n (n_term)
|
// Calculate IDF: n (n_term)
|
||||||
$uniqueTerms = array();
|
$uniqueTerms = array();
|
||||||
foreach($terms as &$term)
|
foreach($terms as &$term)
|
||||||
|
|
@ -314,6 +316,14 @@
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
catch(\Exception $e) {
|
||||||
|
$this->db->rollback();
|
||||||
|
$this->db->setAutocommit(true);
|
||||||
|
throw $e;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->db->setAutocommit(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue