<commit_before>import { connect } from 'react-redux'
import valuesIn from 'lodash/valuesIn'
import flatten from 'lodash/flatten'
import loadAjaxData from '../../../Backend/actions/loadAjaxData'
import PersonalOrTeamStatisticCharts from '../components/PersonalOrTeamStatisticCharts'

const mapStateToProps = (state, ownProps) => {
  const chartType = 'User'
  let selectIdentifier = 'controlled-select-view-' + chartType + 'Statistics'
  const trackableId =
    state.ui[selectIdentifier] || state.entities['current-user-id']
  const dataKey = 'personalStatistics#' + trackableId
  const statisticCharts = valuesIn(state.entities['statistic-charts']).filter(
    chart => chart['user-id'] == trackableId
  )
  let currentUser = state.entities.users[state.entities['current-user-id']]
  let selectableData = [[currentUser.id, currentUser.name]]
  // append userIds of users in ledTeams
  let ledTeams = valuesIn(state.entities['user-teams']).filter(
    t => currentUser['led-team-ids'] && currentUser['led-team-ids'].includes(t.id)
  )
  selectableData = selectableData.concat(
    ledTeams ?
    flatten(ledTeams.map(team => {
      return team['user-ids'].map(userId => {
        return [userId, `${state.entities.users[userId].name} (${team.name})`]
      })
    })) : []
  )
  const dataLoaded = state.ajax.isLoading[dataKey] === false &&<commit_msg>Bugfix: account for empty user_ids array of team in personalStatistics<commit_after>import { connect } from 'react-redux'
import valuesIn from 'lodash/valuesIn'
import flatten from 'lodash/flatten'
import loadAjaxData from '../../../Backend/actions/loadAjaxData'
import PersonalOrTeamStatisticCharts from '../components/PersonalOrTeamStatisticCharts'

const mapStateToProps = (state, ownProps) => {
  const chartType = 'User'
  let selectIdentifier = 'controlled-select-view-' + chartType + 'Statistics'
  const trackableId =
    state.ui[selectIdentifier] || state.entities['current-user-id']
  const dataKey = 'personalStatistics#' + trackableId
  const statisticCharts = valuesIn(state.entities['statistic-charts']).filter(
    chart => chart['user-id'] == trackableId
  )
  let currentUser = state.entities.users[state.entities['current-user-id']]
  let selectableData = [[currentUser.id, currentUser.name]]
  // append userIds of users in ledTeams
  let ledTeams = valuesIn(state.entities['user-teams']).filter(
    t => currentUser['led-team-ids'] && currentUser['led-team-ids'].includes(t.id)
  )
  selectableData = selectableData.concat(
    ledTeams ?
    flatten(ledTeams.map(team => {
      return team['user-ids'] ? team['user-ids'].map(userId => {
        return [userId, `${state.entities.users[userId].name} (${team.name})`]
      }) : []
    })) : []
  )
  const dataLoaded = state.ajax.isLoading[dataKey] === false &&
{'fraction_non_alphanumeric': 0.14998205956225333, 'fraction_numerical': 0.0, 'mean_word_length': 4.499013806706114, 'pattern_counts': {'":': 0, '<': 3, '<?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': '3140522', 'n_tokens_mistral': 873, 'n_tokens_neox': 877, 'n_words': 168}