<commit_before><?php

class CharacterController extends BaseController {

	/*
	|--------------------------------------------------------------------------
	| getAll()
	|--------------------------------------------------------------------------
	|
	| Get all of the characters on record
	|
	*/

	public function getAll()
	{

		$characters = DB::table('account_apikeyinfo_characters')
			->leftJoin('seat_keys', 'account_apikeyinfo_characters.keyID', '=', 'seat_keys.keyID')
			->join('character_charactersheet', 'account_apikeyinfo_characters.characterID', '=', 'character_charactersheet.characterID')
			->join('character_skillintraining', 'account_apikeyinfo_characters.characterID', '=', 'character_skillintraining.characterID')
			->groupBy('account_apikeyinfo_characters.characterID')
			->get();

		// Set an array with the character info that we have
		$character_info = null;
		foreach (DB::table('eve_characterinfo')->get() as $character)
			$character_info[$character->characterID] = $character;

		return View::make('character.all')
			->with('characters', $characters)
			->with('character_info', $character_info);
	}

	/*
	|--------------------------------------------------------------------------
	| getView()
	|--------------------------------------------------------------------------
	|
	| Get all of the information that we possibly have for a specific
	| characterID. This includes a character sheet, skill sheet, skill queue,
	| wallet journal, mail, notifications & assets
	|
	| Outstanding information for this function is still:
	|	Wallet Transactions, Attribute Enhancers, Contact Lists, Industry Jobs
	|	Standings
	|
	*/

	public function getView($characterID)
	{

		$character = DB::table('account_apikeyinfo_characters')
			->leftJoin('account_apikeyinfo', 'account_apikeyinfo_characters.keyID', '=', 'account_apikeyinfo.keyID')
			->leftJoin('seat_keys', 'account_apikeyinfo_characters.keyID', '=', 'seat_keys.keyID')
			->join('account_accountstatus', 'account_apikeyinfo_characters.keyID', '=', 'account_accountstatus.keyID')
			->join('character_charactersheet', 'account_apikeyinfo_characters.characterID', '=', 'character_charactersheet.characterID')
			->join('character_skillintraining', 'account_apikeyinfo_characters.characterID', '=', 'character_skillintraining.characterID')
			->leftJoin('invTypes', 'character_skillintraining.trainingTypeID', '=', 'invTypes.typeID')
			->where('character_charactersheet.characterID', $characterID)
			->first();

		// Check if whave knowledge of this character, else, simply redirect to the
		// public character function
		if(count($character) <= 0)
			return Redirect::action('CharacterController@getPublic', array('characterID' => $characterID))
				->withErrors('No API key information is available for this character. This is the public view of the character. Submit a API key with this character on for more information.');

		$other_characters = DB::table('account_apikeyinfo_characters')
			->join('character_charactersheet', 'account_apikeyinfo_characters.characterID', '=', 'character_charactersheet.characterID')
			->join('character_skillintraining', 'account_apikeyinfo_characters.characterID', '=', 'character_skillintraining.characterID')
			->where('account_apikeyinfo_characters.keyID', $character->keyID)
			->where('account_apikeyinfo_characters.characterID', '<>', $character->characterID)
			->get();

		// Get the other characters linked to this key as a person if any
		$_key = $character->keyID;	// Small var declaration as I doubt you can use $character->keyID in the closure
		$people = DB::table('seat_people')
			->leftJoin('account_apikeyinfo_characters', 'seat_people.keyID', '=', 'account_apikeyinfo_characters.keyID')
			->whereIn('personID', function($query) use ($_key) {

				$query->select('personID')
					->from('seat_people')
					->where('keyID', $_key);
			})<commit_msg>fix duplicate characters in person group<commit_after><?php

class CharacterController extends BaseController {

	/*
	|--------------------------------------------------------------------------
	| getAll()
	|--------------------------------------------------------------------------
	|
	| Get all of the characters on record
	|
	*/

	public function getAll()
	{

		$characters = DB::table('account_apikeyinfo_characters')
			->leftJoin('seat_keys', 'account_apikeyinfo_characters.keyID', '=', 'seat_keys.keyID')
			->join('character_charactersheet', 'account_apikeyinfo_characters.characterID', '=', 'character_charactersheet.characterID')
			->join('character_skillintraining', 'account_apikeyinfo_characters.characterID', '=', 'character_skillintraining.characterID')
			->groupBy('account_apikeyinfo_characters.characterID')
			->get();

		// Set an array with the character info that we have
		$character_info = null;
		foreach (DB::table('eve_characterinfo')->get() as $character)
			$character_info[$character->characterID] = $character;

		return View::make('character.all')
			->with('characters', $characters)
			->with('character_info', $character_info);
	}

	/*
	|--------------------------------------------------------------------------
	| getView()
	|--------------------------------------------------------------------------
	|
	| Get all of the information that we possibly have for a specific
	| characterID. This includes a character sheet, skill sheet, skill queue,
	| wallet journal, mail, notifications & assets
	|
	| Outstanding information for this function is still:
	|	Wallet Transactions, Attribute Enhancers, Contact Lists, Industry Jobs
	|	Standings
	|
	*/

	public function getView($characterID)
	{

		$character = DB::table('account_apikeyinfo_characters')
			->leftJoin('account_apikeyinfo', 'account_apikeyinfo_characters.keyID', '=', 'account_apikeyinfo.keyID')
			->leftJoin('seat_keys', 'account_apikeyinfo_characters.keyID', '=', 'seat_keys.keyID')
			->join('account_accountstatus', 'account_apikeyinfo_characters.keyID', '=', 'account_accountstatus.keyID')
			->join('character_charactersheet', 'account_apikeyinfo_characters.characterID', '=', 'character_charactersheet.characterID')
			->join('character_skillintraining', 'account_apikeyinfo_characters.characterID', '=', 'character_skillintraining.characterID')
			->leftJoin('invTypes', 'character_skillintraining.trainingTypeID', '=', 'invTypes.typeID')
			->where('character_charactersheet.characterID', $characterID)
			->first();

		// Check if whave knowledge of this character, else, simply redirect to the
		// public character function
		if(count($character) <= 0)
			return Redirect::action('CharacterController@getPublic', array('characterID' => $characterID))
				->withErrors('No API key information is available for this character. This is the public view of the character. Submit a API key with this character on for more information.');

		$other_characters = DB::table('account_apikeyinfo_characters')
			->join('character_charactersheet', 'account_apikeyinfo_characters.characterID', '=', 'character_charactersheet.characterID')
			->join('character_skillintraining', 'account_apikeyinfo_characters.characterID', '=', 'character_skillintraining.characterID')
			->where('account_apikeyinfo_characters.keyID', $character->keyID)
			->where('account_apikeyinfo_characters.characterID', '<>', $character->characterID)
			->get();

		// Get the other characters linked to this key as a person if any
		$_key = $character->keyID;	// Small var declaration as I doubt you can use $character->keyID in the closure
		$people = DB::table('seat_people')
			->leftJoin('account_apikeyinfo_characters', 'seat_people.keyID', '=', 'account_apikeyinfo_characters.keyID')
			->whereIn('personID', function($query) use ($_key) {

				$query->select('personID')
					->from('seat_people')
					->where('keyID', $_key);
			})
			->groupBy('characterID')
{'fraction_non_alphanumeric': 0.20411291352663175, 'fraction_numerical': 0.00025546046749265553, 'mean_word_length': 3.7714808043875685, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 72, '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': '5899441', 'n_tokens_mistral': 2377, 'n_tokens_neox': 2188, 'n_words': 458}