<commit_before>import * as ActionTypes from 'builder/actions/actionTypes';
import { combineReducers } from 'redux';
import assets from 'builder/assets/reducers';
import affinities from 'builder/affinities/reducers';

const sponsor = (
   state = { sponsorName: '<NAME>', rank: 0, baseRank: 0, teamValue: 0, units: [], coachingDice: 0, specialMoveCards: 0, nastySurpriseCards: 0, wagers: 0, mediBots: 0, cheerleaders: 0 },
   action) => {
   const { type, payload } = action;

   if (!payload) {
      return { ...state };
   }

   switch (type) {
   case ActionTypes.CLEAR_TEAM:
      return {
         rank: 0,
         baseRank: 0,
         teamValue: 0,
         units: [],
         sponsorName: '<NAME>'
      };
   case ActionTypes.ADD_TEAM_UNIT:
      return {
         ...state,
         units: [...state.units, payload]
      };
   case ActionTypes.REMOVE_TEAM_UNIT: {
      const unitsUpdated = state.units;
      const unitIndex = unitsUpdated.indexOf(payload);
      if (unitIndex !== -1) {
         unitsUpdated.splice(unitIndex, 1);
      }

      return {
         ...state,
         units: unitsUpdated
      };
   }
   case ActionTypes.SET_BASE_RANK:
      return {
         ...state,
         baseRank: payload
      };
   case ActionTypes.SET_RANK:
      return {
         ...state,
         rank: payload
      };
   case ActionTypes.SET_TEAM_VALUE:
      return {
         ...state,
         teamValue: payload
      };
   default:<commit_msg>Fixed unit removal<commit_after>import * as ActionTypes from 'builder/actions/actionTypes';
import { combineReducers } from 'redux';
import assets from 'builder/assets/reducers';
import affinities from 'builder/affinities/reducers';

const sponsor = (
   state = { sponsorName: '<NAME>', rank: 0, baseRank: 0, teamValue: 0, units: [], coachingDice: 0, specialMoveCards: 0, nastySurpriseCards: 0, wagers: 0, mediBots: 0, cheerleaders: 0 },
   action) => {
   const { type, payload } = action;

   if (!payload) {
      return { ...state };
   }

   switch (type) {
   case ActionTypes.CLEAR_TEAM:
      return {
         rank: 0,
         baseRank: 0,
         teamValue: 0,
         units: [],
         sponsorName: 'Sponsor name'
      };
   case ActionTypes.ADD_TEAM_UNIT:
      return {
         ...state,
         units: [...state.units, payload]
      };
   case ActionTypes.REMOVE_TEAM_UNIT: {
      let unitsUpdated = state.units;
      const unitIndex = unitsUpdated.indexOf(payload);
      if (unitIndex !== -1) {
         unitsUpdated = state.units.filter((x, i) => i !== unitIndex);
      }

      return {
         ...state,
         units: unitsUpdated
      };
   }
   case ActionTypes.SET_BASE_RANK:
      return {
         ...state,
         baseRank: payload
      };
   case ActionTypes.SET_RANK:
      return {
         ...state,
         rank: payload
      };
   case ActionTypes.SET_TEAM_VALUE:
      return {
         ...state,
         teamValue: payload
      };
   default:
{'fraction_non_alphanumeric': 0.12457798784604997, 'fraction_numerical': 0.00911546252532073, 'mean_word_length': 2.0832466181061395, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 9, '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': '2872811', 'n_tokens_mistral': 943, 'n_tokens_neox': 903, 'n_words': 219}