<commit_before><?php

// <NAME>
// 2017-01-13

namespace Sugarcrm\Sugarcrm\custom\Console\Command\SystemData;

class SystemDataTeams extends SystemData {

    public function getTeams() {
        global $current_user;
        $db = \DBManagerFactory::getInstance();

        // retrieve also deleted, but only non private and non global new Teams
        $query = "SELECT id, name, description, deleted " .
            "FROM teams where private = '0' and id != '1' " .
            "order by name, id ";
        $res = $db->query($query);

        $list_records = array();

        while ($row = $db->fetchByAssoc($res)) {
            if(!empty($row['id']) && !empty($row['name'])) {
                foreach($row as $field => $value) {
                    $list_records[$row['id']][$field] = $value;
                }
            
                if(!$row['deleted']) {
                    unset($list_records[$row['id']]['deleted']);
                }
            }
        }

        return $list_records;
    }

    public function saveTeamsArray($teams) {
        $this->saveBeansArray('Teams', $teams, 'name');
    }
}<commit_msg>Solved bug about Teams import improperly showing results<commit_after><?php

// <NAME>
// 2017-01-13

namespace Sugarcrm\Sugarcrm\custom\Console\Command\SystemData;

class SystemDataTeams extends SystemData {

    public function getTeams() {
        global $current_user;
        $db = \DBManagerFactory::getInstance();

        // retrieve also deleted, but only non private and non global new Teams
        $query = "SELECT id, name, description, deleted " .
            "FROM teams where private = '0' and id != '1' " .
            "order by name, id ";
        $res = $db->query($query);

        $list_records = array();

        while ($row = $db->fetchByAssoc($res)) {
            if(!empty($row['id']) && !empty($row['name'])) {
                foreach($row as $field => $value) {
                    $list_records[$row['id']][$field] = $value;
                }
            
                if(!$row['deleted']) {
                    unset($list_records[$row['id']]['deleted']);
                }
            }
        }

        return $list_records;
    }

    public function saveTeamsArray($teams) {
        return $this->saveBeansArray('Teams', $teams, 'name');
    }
}
{'fraction_non_alphanumeric': 0.15185504745470232, 'fraction_numerical': 0.008628127696289905, 'mean_word_length': 1.93173198482933, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 13, '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': '3521116', 'n_tokens_mistral': 693, 'n_tokens_neox': 656, 'n_words': 150}