<commit_before><?php

/**
 * This is the model class for table "surveys".
 *
 * The followings are the available columns in table 'surveys':
 * @property integer $id
 * @property string $title
 * @property string $description
 * @property integer $created_for_id
 * @property integer $created_by_id
 * @property string $created_at
 * @property integer $updated_by_id
 * @property string $updated_at
 *
 * The followings are the available model relations:
 * @property QuestionGroups[] $questionGroups
 * @property Takings[] $takings
 */
class Survey extends CActiveRecord
{

	//TODO : Better error handling and object return
	public function getCreatedByName()
	{
		$intranetUser = new IntranetUser;
		$user = $intranetUser->find($this->created_by_id);
		if (!$user === false)
			return $user->name;
		else
			return $intranetUser->error_message;
	}

	public function getUpdatedByName()
	{
		$intranetUser = new IntranetUser;
		$user = $intranetUser->find($this->updated_by_id);
		if (!$user === false)
			return $user->name;
		else
			return $intranetUser->error_message;
	}

	public function getCreatedForName()
	{
		$intranetUser = new IntranetUser;
		$user = $intranetUser->find($this->created_for_id);
		if (!$user === false)
			return $user->name;
		else
			return $intranetUser->error_message;<commit_msg>Corrected potential bug in survey model<commit_after><?php

/**
 * This is the model class for table "surveys".
 *
 * The followings are the available columns in table 'surveys':
 * @property integer $id
 * @property string $title
 * @property string $description
 * @property integer $created_for_id
 * @property integer $created_by_id
 * @property string $created_at
 * @property integer $updated_by_id
 * @property string $updated_at
 *
 * The followings are the available model relations:
 * @property QuestionGroups[] $questionGroups
 * @property Takings[] $takings
 */
class Survey extends CActiveRecord
{

	//TODO : Better error handling and object return
	public function getCreatedByName()
	{
		$intranetUser = new IntranetUser;
		if($this->created_by_id != NULL) {
			$user = $intranetUser->find($this->created_by_id);
			if (!$user === false)
				return $user->name;
			else
				return $intranetUser->error_message;
		}
		else {
			return "-";
		}
	}

	public function getUpdatedByName()
	{
		$intranetUser = new IntranetUser;
		if($this->updated_by_id != NULL) {
			$user = $intranetUser->find($this->updated_by_id);
			if (!$user === false)
				return $user->name;
			else
				return $intranetUser->error_message;
		}
		else {
			return "-";
		}
	}

	public function getCreatedForName()
	{
		$intranetUser = new IntranetUser;
		if($this->created_for_id != NULL) {
			$user = $intranetUser->find($this->created_for_id);
			if (!$user === false)
				return $user->name;
			else
				return $intranetUser->error_message;
		}
		else {
			return "-";
		}
{'fraction_non_alphanumeric': 0.12565262791507134, 'fraction_numerical': 0.0, 'mean_word_length': 4.150537634408602, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 30, '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': '3800221', 'n_tokens_mistral': 1019, 'n_tokens_neox': 935, 'n_words': 244}