<commit_before><?php
class Vpc_User_Detail_Rating_Component extends Vpc_Abstract
{
    public static function getSettings()
    {
        $ret = parent::getSettings();
        $ret['componentName'] = 'Rating';
        $ret['pointsPerPost'] = 1;
        $ret['pointsPerThread'] = 5;
        $ret['starsTable'] = array(
            //points => stars
            0 => 1,
            10 => 2,
            100 => 3,
            200 => 4,
            300 => 5
        );
        return $ret;
    }

    public function getTemplateVars()
    {
        $ret = parent::getTemplateVars();
        $ret['rating'] = $this->getRating();
        return $ret;
    }
    
    public function getRating()
    {
        $userId = $this->getData()->parent->row->id;
        $select = Zend_Registry::get('db')->select();
        $select->from(array('p'=> 'vpc_posts'), array('count'=>'COUNT(p.id)'))
                ->where('p.user_id = ?', $userId);
        $posts = $select->query()->fetchAll();
        $posts = $posts[0]['count'];

        $select = Zend_Registry::get('db')->select();
        $select->from(array('t'=> 'vpc_forum_threads'), array('count'=>'COUNT(t.id)'))
                ->where('t.user_id = ?', $userId);
        $threads = $select->query()->fetchAll();
        $threads = $threads[0]['count'];

        $points = $posts*$this->_getSetting('pointsPerPost') + $threads*$this->_getSetting('pointsPerThread');<commit_msg>Kleiner bugfix<commit_after><?php
class Vpc_User_Detail_Rating_Component extends Vpc_Abstract
{
    public static function getSettings()
    {
        $ret = parent::getSettings();
        $ret['componentName'] = 'Rating';
        $ret['pointsPerPost'] = 1;
        $ret['pointsPerThread'] = 5;
        $ret['starsTable'] = array(
            //points => stars
            0 => 1,
            10 => 2,
            100 => 3,
            200 => 4,
            300 => 5
        );
        return $ret;
    }

    public function getTemplateVars()
    {
        $ret = parent::getTemplateVars();
        $ret['rating'] = $this->getRating();
        return $ret;
    }

    public function getRating()
    {
        $userId = $this->getData()->parent->parent->row->id;
        $select = Zend_Registry::get('db')->select();
        $select->from(array('p'=> 'vpc_posts'), array('count'=>'COUNT(p.id)'))
                ->where('p.user_id = ?', $userId);
        $posts = $select->query()->fetchAll();
        $posts = $posts[0]['count'];

        $select = Zend_Registry::get('db')->select();
        $select->from(array('t'=> 'vpc_forum_threads'), array('count'=>'COUNT(t.id)'))
                ->where('t.user_id = ?', $userId);
        $threads = $select->query()->fetchAll();
        $threads = $threads[0]['count'];

        $points = $posts*$this->_getSetting('pointsPerPost') + $threads*$this->_getSetting('pointsPerThread');
{'fraction_non_alphanumeric': 0.19529329118370214, 'fraction_numerical': 0.014752370916754479, 'mean_word_length': 2.307781649245064, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 58, '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': '6628711', 'n_tokens_mistral': 896, 'n_tokens_neox': 858, 'n_words': 144}