<commit_before><?php
/**
 * @copyright (C) 2012 by iRail vzw/asbl
 * @license AGPLv3
 * @author <NAME> <jens at iRail.be>
 * @author <NAME> <hannes at iRail.be>
 */

if (!defined('BASEPATH'))
    exit('No direct script access allowed');

class Dashboard extends MY_Controller {
    
    public function index() {
        $this->load->model('clan_model');
        $clans = $this->clan_model->get_all();
        
        if ($user = $this->auth->current_user()) {
            $clan = $this->clan_model->get($user['clanid']);
            
            if (!$notifications = $this->cache->get('api/notifications-' . $user['fsqid'] . '.cache')) {
                $this->load->model('notification_model');
                $notifications = $this->notification_model->get_personal($user['fsqid']);
                $this->cache->save('api/notifications-' . $user['fsqid'] . '.cache', $notifications, 60);
            }
        } else {
            $clan = FALSE;
            $notifications = array();
        }
        
        $this->load->view('dashboard', array('clan' => $clan, 'clans' => $clans, 'notifications' => $notifications));
    }
}<commit_msg>Notifications cache<commit_after><?php
/**
 * @copyright (C) 2012 by iRail vzw/asbl
 * @license AGPLv3
 * @author <NAME> <jens at iRail.be>
 * @author <NAME> <hannes at iRail.be>
 */

if (!defined('BASEPATH'))
    exit('No direct script access allowed');

class Dashboard extends MY_Controller {
    
    public function index() {
        $this->load->model('clan_model');
        $clans = $this->clan_model->get_all();
        
        if ($user = $this->auth->current_user()) {
            $clan = $this->clan_model->get($user['clanid']);
            
            $this->load->driver('cache');
            if (!$notifications = $this->cache->get('api/notifications-' . $user['fsqid'] . '.cache')) {
                $this->load->model('notification_model');
                $notifications = $this->notification_model->get_personal($user['fsqid']);
                $this->cache->save('api/notifications-' . $user['fsqid'] . '.cache', $notifications, 60);
            }
        } else {
            $clan = FALSE;
            $notifications = array();
        }
        
        $this->load->view('dashboard', array('clan' => $clan, 'clans' => $clans, 'notifications' => $notifications));
    }
}
{'fraction_non_alphanumeric': 0.18787361229718189, 'fraction_numerical': 0.005977796754910333, 'mean_word_length': 2.371223021582734, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 55, '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': '6067613', 'n_tokens_mistral': 752, 'n_tokens_neox': 728, 'n_words': 134}