<commit_before><?php
class Wub_Memory_List extends Wub_List
{
    function __construct($options = array())
    {
        if (!isset($options['model']) || (!in_array($options['model'], array('Wub_Memory_List', 'Wub_Memory_List_Timeline')))) {
            parent::__construct($options);
            return;
        }
        
        if (!isset($options['account_id'])) {
            throw new Exception("No account specified.", 404);
        }
        
        $options['returnArray'] = true;
        
        $options['array'] = self::getDynamicForAccount($options['account_id'], $options);
        
        parent::__construct($options);
    }
    
    function getDefaultOptions()
    {
        $options = array();
        $options['itemClass'] = 'Wub_Memory';
        $options['listClass'] = 'Wub_Memory_List';
        
        return $options;
    }
    
    /**
     * get a list of all memorys that a user owns.
     *
     * @param $accountID The id of the memory to generate the list for..
     * @param $options array of options for constructing the list.
     * 
     * @return object Wub_Memory_List
     */
    public static function getAllByAccount($accountID, $options = array())
    {
        $options        = $options + self::getDefaultOptions();
        $options['sql'] = "SELECT id FROM memories WHERE owner_id = " . (int)$accountID;
        return self::getBySql($options);
    }
    
    public static function getDynamicForAccount($accountID, $options = array()) {
        $options = $options + self::getDefaultOptions();
        
        $whereAdd = "";
        if (Wub_Controller::getAccount()) {
            $whereAdd = "OR shared_memory.account_id = " . (int)Wub_Controller::getAccount()->id . " OR memories.owner_id = " . (int)Wub_Controller::getAccount()->id;
        }
        
        $options['sql'] = "SELECT memories.id FROM memories LEFT JOIN (shared_memory) ON (shared_memory.memory_id = memories.id) WHERE memories.owner_id = " . (int)$accountID . " AND  (memories.permission = 'public' " .  $whereAdd . ") ORDER BY memories.date_created ASC";
        
        return self::getBySql($options);
    }

}<commit_msg>group.<commit_after><?php
class Wub_Memory_List extends Wub_List
{
    function __construct($options = array())
    {
        if (!isset($options['model']) || (!in_array($options['model'], array('Wub_Memory_List', 'Wub_Memory_List_Timeline')))) {
            parent::__construct($options);
            return;
        }
        
        if (!isset($options['account_id'])) {
            throw new Exception("No account specified.", 404);
        }
        
        $options['returnArray'] = true;
        
        $options['array'] = self::getDynamicForAccount($options['account_id'], $options);
        
        parent::__construct($options);
    }
    
    function getDefaultOptions()
    {
        $options = array();
        $options['itemClass'] = 'Wub_Memory';
        $options['listClass'] = 'Wub_Memory_List';
        
        return $options;
    }
    
    /**
     * get a list of all memorys that a user owns.
     *
     * @param $accountID The id of the memory to generate the list for..
     * @param $options array of options for constructing the list.
     * 
     * @return object Wub_Memory_List
     */
    public static function getAllByAccount($accountID, $options = array())
    {
        $options        = $options + self::getDefaultOptions();
        $options['sql'] = "SELECT id FROM memories WHERE owner_id = " . (int)$accountID;
        return self::getBySql($options);
    }
    
    public static function getDynamicForAccount($accountID, $options = array()) {
        $options = $options + self::getDefaultOptions();
        
        $whereAdd = "";
        if (Wub_Controller::getAccount()) {
            $whereAdd = "OR shared_memory.account_id = " . (int)Wub_Controller::getAccount()->id . " OR memories.owner_id = " . (int)Wub_Controller::getAccount()->id;
        }
        
        $options['sql'] = "SELECT memories.id FROM memories LEFT JOIN (shared_memory) ON (shared_memory.memory_id = memories.id) WHERE memories.owner_id = " . (int)$accountID . " AND  (memories.permission = 'public' " .  $whereAdd . ") GROUP BY memories.id ORDER BY memories.date_created ASC";
        
        return self::getBySql($options);
    }

}
{'fraction_non_alphanumeric': 0.13861845155308297, 'fraction_numerical': 0.0013908205841446453, 'mean_word_length': 2.508130081300813, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, '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': '5360484', 'n_tokens_mistral': 1234, 'n_tokens_neox': 1218, 'n_words': 273}