<commit_before><?
/**
 * functions used by command line scripts
 *
 * @author <NAME> <<EMAIL>>
 * @package Basisentscheid
 */


/**
 * called by cli/cron.php
 */
function cron() {

	$sql_period = "SELECT *,
		debate      <= now() AS debate_now,
		preparation <= now() AS preparation_now,
		voting      <= now() AS voting_now,
		counting    <= now() AS counting_now
	FROM periods";
	$result_period = DB::query($sql_period);
	while ( $row_period = pg_fetch_assoc($result_period) ) {

		$issues_start_voting = array();

		$period = new Period($row_period);
		DB::pg2bool($period->debate_now);
		DB::pg2bool($period->preparation_now);
		DB::pg2bool($period->voting_now);
		DB::pg2bool($period->counting_now);

		$sql_issue = "SELECT *, clear <= now() AS clear_now FROM issues WHERE period=".intval($period->id);
		$result_issue = DB::query($sql_issue);
		while ( $row_issue = pg_fetch_assoc($result_issue) ) {

			$issue = new Issue($row_issue);
			DB::pg2bool($period->clear_now);

			// admitted -> debate
			switch ($issue->state) {
			case "admission":
				if (!$period->debate_now) break;

				$all_proposals_revoked = true;
				$admitted_proposals = false;
				$not_admitted_proposals = false;
				foreach ( $issue->proposals() as $proposal ) {
					if ($proposal->state=="revoked" or $proposal->state=="cancelled" or $proposal->state=="done") continue;<commit_msg>fix: clearing<commit_after><?
/**
 * functions used by command line scripts
 *
 * @author <NAME> <<EMAIL>>
 * @package Basisentscheid
 */


/**
 * called by cli/cron.php
 */
function cron() {

	$sql_period = "SELECT *,
		debate      <= now() AS debate_now,
		preparation <= now() AS preparation_now,
		voting      <= now() AS voting_now,
		counting    <= now() AS counting_now
	FROM periods";
	$result_period = DB::query($sql_period);
	while ( $row_period = pg_fetch_assoc($result_period) ) {

		$issues_start_voting = array();

		$period = new Period($row_period);
		DB::pg2bool($period->debate_now);
		DB::pg2bool($period->preparation_now);
		DB::pg2bool($period->voting_now);
		DB::pg2bool($period->counting_now);

		$sql_issue = "SELECT *, clear <= now() AS clear_now FROM issues WHERE period=".intval($period->id);
		$result_issue = DB::query($sql_issue);
		while ( $row_issue = pg_fetch_assoc($result_issue) ) {

			$issue = new Issue($row_issue);
			DB::pg2bool($issue->clear_now);

			// admitted -> debate
			switch ($issue->state) {
			case "admission":
				if (!$period->debate_now) break;

				$all_proposals_revoked = true;
				$admitted_proposals = false;
				$not_admitted_proposals = false;
				foreach ( $issue->proposals() as $proposal ) {
					if ($proposal->state=="revoked" or $proposal->state=="cancelled" or $proposal->state=="done") continue;
{'fraction_non_alphanumeric': 0.1672155140870838, 'fraction_numerical': 0.003658982802780827, 'mean_word_length': 4.2984496124031, 'pattern_counts': {'":': 2, '<': 21, '<?xml version=': 0, '>': 35, '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': '1739132', 'n_tokens_mistral': 1059, 'n_tokens_neox': 947, 'n_words': 192}