Takes a tournament and returns the teams in order of
their occurences within the SWT.

@param {Object} tournament object after parsing process
@return {Array} of teams
507406
function getOrderedTeams (tnmt) {
  var res = []
  for (var i = 0; i < tnmt.teams.length; i++) {
    res[tnmt.teams[i].positionInSWT] = tnmt.teams[i]['1018']
  }
  return res
}
1038488
function processGroupsKeys(){
				var GroupsKeys = [];
				var MatchKeys = [];

				module.groups.forEach(function(group){
					GroupsKeys.push({
						value: group.get('id'),
						text: group.get('name'),
					});

					group.get('matches').forEach(function(match){
						var title = group.get('name') + ': ';
						title += match.teamA ? match.teamA.name : '[?]';
						title += ' x ';
						title += match.teamB ? match.teamB.name : '[?]';

						MatchKeys.push({
							value: match.id,
							text: title,
						});
					});
				});

				module.GroupsKeys = GroupsKeys;
				module.MatchKeys = MatchKeys;
			}
964192
def team(self, team_id):
        
        json = None
        if int(team_id) > 0:
            url = self._build_url('teams', str(team_id))
            json = self._json(self._get(url), 200)
        return Team(json, self._session) if json else None
670369
public function majRankPointChart()
    {
        $teams = $this->findBy(array(), array('pointChart' => 'DESC'));

        $list = array();
        foreach ($teams as $team) {
            $list[] = $team;
        }

        Ranking::addObjectRank($list, 'rankPointChart', array('pointChart'));
        $this->getEntityManager()->flush();
    }
961917
function Tourney(np, inst) {
  this._inst = inst;
  this.matches = inst.matches; // proxy reference
  this.oldMatches = []; // stash matches from completed instances here
  this._stage = 1;
  this._oldRes = [];
  this.state = [];
  // for determining when we can expect Tourney API
  Object.defineProperty(this, 'hasStages', { value: true });
}
373064
function findAssociated(id, next){

	// Data to be rendered
	var data = [];
	// Wait for parallel tasks to complete
	var completed = 0;
	var where = (id ? {id: id} : null);

	// Query Table model, and call afterFindTables when done.
	var finding = app.models.Group
		.find()
		.where(where)
		.exec(function afterFound(err, models) {
			if(!err)
				afterFindGroups(models);
		});


	// After finishing search
	function afterFindGroups(models){
		data = models;
		completed = 0;

		if(data.length <= 0)
			return next([]);

		// Load Matches for each Group and associates
		data.forEach(function(group){

			app.models.Match.find()
				.where({'groupId': group.id})
				.sort('state DESC')
				.sort('day ASC')
				.sort('hour ASC')
				.sort('id')
				.then(function(matches){
				// Associate matches with groups
				group.matches = matches;

				// Compute scoring table for each group
				// (must be computed AFTER associating matches with it)
				group.table = group.table();

				// Callback
				loadedModel();
			});
		});
	}

	// Function needed to wait for all queries to finish
	function loadedModel(){
		completed++;

		if(completed >= data.length)
			associateTeams();
	}

	// Load Teams
	function associateTeams(){
		app.models.Team.find(afterFindTeams);
	}

	// Associate keys with teams
	function afterFindTeams(err, teamData){
		var teamList = {};

		// Load teams and assing it's key as it's id
		teamData.forEach(function(team){
			teamList[team.id] = team;
		});

		// Includes team object in 'table' data
		data.forEach(function(group){

			// console.log(group);
			// Go trough all the table adding key 'team' with team data
			_.forEach(group.table, function(row){
				row.team = teamList[row.teamId];
			});
		});

		// Includes team object in 'match' data
		data.forEach(function(group){

			// console.log(group);
			// Go trough all the table adding key 'team' with team data
			_.forEach(group.matches, function(row){
				row.teamA = teamList[row.teamAId];
				row.teamB = teamList[row.teamBId];
			});
		});

		next(data);
	}
}
1098278
public Future<Map<String, List<LeagueItem>>> getLeagueEntries(String... teamIds) {
        return new ApiFuture<>(() -> handler.getLeagueEntries(teamIds));
    }
830008
@SuppressWarnings("unchecked")
    public MappedLdapGroup getMappedLdapGroup(final Team team, final String dn) {
        final Query query = pm.newQuery(MappedLdapGroup.class, "team == :team && dn == :dn");
        final List<MappedLdapGroup> result = (List<MappedLdapGroup>) query.execute(team, dn);
        return Collections.isEmpty(result) ? null : result.get(0);
    }
141848
function getMembers(index) {
  if (this._members === undefined) {
    this._members = _(getValue(this, 'member') || getValue(this, 'memberOf'))
      .split(/,\s*/)
      .compact()
      .sort(util.compareNatural)
      .value();
  }
  var result = this._members;
  return index === undefined ? result : result[index];
}
744061
@Override
    public final Integer getCost(final SponsorTeam team) {
        Integer valoration;

        checkNotNull(team, "Received a null pointer as the team");

        valoration = 0;
        for (final TeamPlayer player : team.getPlayers().values()) {
            valoration += player.getCost();
        }

        valoration += team.getCoachingDice() * getDieCost();
        valoration += team.getNastySurpriseCards() * getSabotageCost();
        valoration += team.getSpecialMoveCards() * getSpecialMoveCost();
        valoration += team.getCheerleaders() * getCheerleaderCost();
        valoration += team.getWagers() * getWagerCost();
        valoration += team.getMediBots() * getMediBotCost();

        return valoration;
    }
1218973
public function getTeam(int $id): array
    {
        return $this->getApi()->request($this->getApi()->sprintf('/teams/:id', (string)$id));
    }
42704
@RequestMapping(value = "/team/{teamId}", method = GET, produces = APPLICATION_JSON_VALUE)
    public DataResponse<Team> team(
            @RequestParam(value = "component", required = true) String cId,
            @PathVariable String teamId) {
        ObjectId componentId = new ObjectId(cId);
        return this.teamService.getTeam(componentId, teamId);
    }
217349
@Override
    public final Integer getCost(final SponsorTeam team) {
        Integer valoration;

        checkNotNull(team, "Received a null pointer as the team");

        valoration = 0;

        valoration += team.getCoachingDice() * getDieCost();
        valoration += team.getNastySurpriseCards() * getNastySurpriseCardCost();
        valoration += team.getSpecialMoveCards() * getSpecialMoveCost();
        valoration += team.getCheerleaders() * getCheerleaderCost();
        valoration += team.getWagers() * getWagerCost();
        valoration += team.getMediBots() * getMediBotCost();

        return valoration;
    }
732186
protected function getTeam($t)
    {
        $teamInfo = (array)$t;
        $team = new Team();
        $fields = array_keys($teamInfo);
        foreach ($fields as $field) {
            // I hope, that API-response will be changed and players_ids, leagues_ids will become arrays
            if (preg_match('/^player_\d+_account_id$/', $field)) {
                $team->addPlayerId($teamInfo[$field]);
                continue;
            }
            if (preg_match('/^league_id_\d+$/', $field)) {
                $team->addLeagueId($teamInfo[$field]);
                continue;
            }
            $team->set($field, (string)$teamInfo[$field]);
        }
        return $team;
    }
804943
function(match){
			/*
				Depending on the match state, we shall render
				a different match view. Templates are:
					+ pageview-group.match.scheduled
					+ pageview-group.match.playing
					+ pageview-group.match.endend
			*/
			var templates = {
				'scheduled': JST['pageview-group.match.scheduled'],
				'playing': JST['pageview-group.match.playing'],
				'ended': JST['pageview-group.match.ended'],
			};

			if(match.state == 'scheduled'){

				return JST['pageview-group.match.scheduled']({match: match});

			}else if(match.state == 'playing'){

				return JST['pageview-group.match.playing']({match: match});

			}else if(match.state == 'ended'){

				// In this case, we need to set the class for A and B.
				// (teamAClass and teamBClass to null, team-win, team-loose)
				return JST['pageview-group.match.ended']({
					match: match,
					
					teamAClass: (match.teamAScore > match.teamBScore ? 'team-win'
								:match.teamAScore < match.teamBScore ? 'team-loose' : ''),

					teamBClass: (match.teamBScore > match.teamAScore ? 'team-win'
								:match.teamBScore < match.teamAScore ? 'team-loose' : ''),
				});
			}
		}
486632
@Override
    public Page<Team> getTeamByCollectorWithFilter(ObjectId collectorId, String teamName, Pageable pageable) {
        Page<Team> teams = teamRepository.findAllByCollectorIdAndNameContainingIgnoreCase(collectorId,teamName,pageable);
        return teams;
    }
933359
@RequestMapping(value = "/team", method = GET, produces = APPLICATION_JSON_VALUE)
    public List<Team> allTeams() {
        return Lists.newArrayList(this.teamService.getAllTeams());
    }