<commit_before><?php
const _API_EXEC = 1;

require_once('internal/skautisTry.php');
require_once('internal/database.secret.php');

function redoCompetences()
{
	$deleteSQL = <<<SQL
DELETE FROM competences_for_lessons
WHERE lesson_id = ?;
SQL;
	$insertSQL = <<<SQL
INSERT INTO competences_for_lessons (lesson_id, competence_id)
VALUES (?, ?);
SQL;

	$deleteStatement = $db->prepare($deleteSQL);
	if($deleteStatement === false)
	{
		throw new Exception('Invalid SQL: "' . $deleteSQL . '". Error: ' . $db->error);
	}
	$deleteStatement->bind_param('i', $id);
	$deleteStatement->execute();
	$deleteStatement->close();
<commit_msg>Fixed bug preventing lesson changing<commit_after><?php
const _API_EXEC = 1;

require_once('internal/skautisTry.php');
require_once('internal/database.secret.php');

function redoCompetences()
{
	$deleteSQL = <<<SQL
DELETE FROM competences_for_lessons
WHERE lesson_id = ?;
SQL;
	$insertSQL = <<<SQL
INSERT INTO competences_for_lessons (lesson_id, competence_id)
VALUES (?, ?);
SQL;

	$db = new mysqli(OdyMaterialyAPI\DB_SERVER, OdyMaterialyAPI\DB_USER, OdyMaterialyAPI\DB_PASSWORD, OdyMaterialyAPI\DB_DBNAME);

	$deleteStatement = $db->prepare($deleteSQL);
	if($deleteStatement === false)
	{
		throw new Exception('Invalid SQL: "' . $deleteSQL . '". Error: ' . $db->error);
	}
	$deleteStatement->bind_param('i', $id);
	$deleteStatement->execute();
	$deleteStatement->close();

{'fraction_non_alphanumeric': 0.16131334760885083, 'fraction_numerical': 0.0014275517487508922, 'mean_word_length': 6.378947368421053, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1265491', 'n_tokens_mistral': 496, 'n_tokens_neox': 483, 'n_words': 90}