Commit fa53300b authored by Martin Gregor's avatar Martin Gregor
Browse files

Fix duplicit pri pridavani viet a odstranenie medzier na zaciatku a konci vety

parent 036814ee
......@@ -46,8 +46,10 @@ class AdminPresenter extends BasePresenter
private function insertSentence($sentence)
{
$sentence = trim($sentence);
$word_count = count(explode(' ',$sentence));
if ($word_count > 3)
$exists = $this->db->table('sentences')->count('*')->where('sentence' => $sentence);
if ($word_count > 3 && !$exists)
$this->db->table('sentences')->insert(['sentence' => $sentence,'word_count' => $word_count]);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment