<commit_before><?php
/**
 * team.php
 *
 * @author <NAME> <<EMAIL>>
 * @copyright 2012 <NAME>
 * @see https://www.elabftw.net Official website
 * @license AGPL-3.0
 * @package elabftw
 */
declare(strict_types=1);

namespace Elabftw\Elabftw;

use Elabftw\Models\Teams;
use Elabftw\Models\Scheduler;
use Elabftw\Models\Templates;
use Elabftw\Models\Database;
use Elabftw\Exceptions\DatabaseErrorException;
use Elabftw\Exceptions\FilesystemErrorException;
use Elabftw\Exceptions\IllegalActionException;
use Elabftw\Exceptions\ImproperActionException;
use Exception;
use Symfony\Component\HttpFoundation\Response;

/**
 * The team page
 *
 */
require_once 'app/init.inc.php';
$App->pageTitle = _('Team');
// default response is error page with general error message
$Response = new Response();
$Response->prepare($Request);

try {
    if ($App->Session->has('anon')) {
        throw new IllegalActionException('Anon user tried accessing the team page');
    }

    $Teams = new Teams($App->Users);
    $teamArr = $Teams->read();
    $teamsStats = $Teams->getAllStats();

    $Database = new Database($App->Users);
    // we only want the bookable type of items
    $Database->bookableFilter = ' AND bookable = 1';
    $Scheduler = new Scheduler($Database);

    $TagCloud = new TagCloud((int) $App->Users->userData['team']);

    $itemsArr = $Database->read();

    $selectedItem = null;
    if ($Request->query->get('item')) {
        $Scheduler->Database->setId((int) $Request->query->get('item'));
        $selectedItem = $Request->query->get('item');

        $Scheduler->populate();
        if (empty($Scheduler->itemData)) {
            throw new ImproperActionException(_('Nothing to show with this id'));
        }
    }<commit_msg>fix team stats on team page (was showing full stats instead of team's)<commit_after><?php
/**
 * team.php
 *
 * @author <NAME> <<EMAIL>>
 * @copyright 2012 <NAME>
 * @see https://www.elabftw.net Official website
 * @license AGPL-3.0
 * @package elabftw
 */
declare(strict_types=1);

namespace Elabftw\Elabftw;

use Elabftw\Models\Teams;
use Elabftw\Models\Scheduler;
use Elabftw\Models\Templates;
use Elabftw\Models\Database;
use Elabftw\Exceptions\DatabaseErrorException;
use Elabftw\Exceptions\FilesystemErrorException;
use Elabftw\Exceptions\IllegalActionException;
use Elabftw\Exceptions\ImproperActionException;
use Exception;
use Symfony\Component\HttpFoundation\Response;

/**
 * The team page
 *
 */
require_once 'app/init.inc.php';
$App->pageTitle = _('Team');
// default response is error page with general error message
$Response = new Response();
$Response->prepare($Request);

try {
    if ($App->Session->has('anon')) {
        throw new IllegalActionException('Anon user tried accessing the team page');
    }

    $Teams = new Teams($App->Users);
    $teamArr = $Teams->read();
    $teamsStats = $Teams->getStats((int) $App->Users->userData['team']);

    $Database = new Database($App->Users);
    // we only want the bookable type of items
    $Database->bookableFilter = ' AND bookable = 1';
    $Scheduler = new Scheduler($Database);

    $TagCloud = new TagCloud((int) $App->Users->userData['team']);

    $itemsArr = $Database->read();

    $selectedItem = null;
    if ($Request->query->get('item')) {
        $Scheduler->Database->setId((int) $Request->query->get('item'));
        $selectedItem = $Request->query->get('item');

        $Scheduler->populate();
        if (empty($Scheduler->itemData)) {
            throw new ImproperActionException(_('Nothing to show with this id'));
        }
    }
{'fraction_non_alphanumeric': 0.15501263689974726, 'fraction_numerical': 0.004493119910137602, 'mean_word_length': 3.9335180055401664, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 57, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, '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': '4349602', 'n_tokens_mistral': 1148, 'n_tokens_neox': 1116, 'n_words': 255}