<commit_before>import * as types from '../actions/actionTypes';
import initialState from './initialState';
import {deduplicateArray} from '../utils/utilityMethods';

export default function currentStatusesReducer(state = initialState.currentCommitStatusesData, action) {
  switch (action.type) {
    case types.STATUSES_LOADED_FOR_CURRENT_COMMIT: {
      const rawContextsList = action.statuses.map(status => {
        return status.context;
      });

      const filteredContextsList = deduplicateArray(rawContextsList);

      return {
        repoId: action.repoId,
        isFromBranch: action.isFromBranch,
        branchName: action.branchName,
        commitSha: action.commitSha,
        statuses: action.statuses,
        contexts: filteredContextsList
      };
    }
    case types.STATUS_CREATED_FOR_COMMIT: {
      let newRawContextsList = Object.assign([], state.contexts);
      let newStatusesArray = Object.assign([], state.statuses);

      // Insert new status into beginning of array
      newStatusesArray.unshift(action.newStatus);
      newRawContextsList.unshift(action.newStatus.context);

      let newFilteredContextsList = deduplicateArray(newRawContextsList);

      return Object.assign({}, state, {
        statuses: newStatusesArray,
        contexts: newFilteredContextsList
      });
    }
    default: {
      return state;
    }
  }
}<commit_msg>Refactor variable names in currentStatusesReducer<commit_after>import * as types from '../actions/actionTypes';
import initialState from './initialState';
import {deduplicateArray} from '../utils/utilityMethods';

export default function currentStatusesReducer(state = initialState.currentCommitStatusesData, action) {
  switch (action.type) {
    case types.STATUSES_LOADED_FOR_CURRENT_COMMIT: {
      const rawContexts = action.statuses.map(status => {
        return status.context;
      });

      const filteredContexts = deduplicateArray(rawContexts);

      return {
        repoId: action.repoId,
        isFromBranch: action.isFromBranch,
        branchName: action.branchName,
        commitSha: action.commitSha,
        statuses: action.statuses,
        contexts: filteredContexts
      };
    }
    case types.STATUS_CREATED_FOR_COMMIT: {
      let newRawContexts = Object.assign([], state.contexts);
      let newStatusesArray = Object.assign([], state.statuses);

      // Insert new status into beginning of array
      newStatusesArray.unshift(action.newStatus);
      newRawContexts.unshift(action.newStatus.context);

      let newFilteredContexts = deduplicateArray(newRawContexts);

      return Object.assign({}, state, {
        statuses: newStatusesArray,
        contexts: newFilteredContexts
      });
    }
    default: {
      return state;
    }
  }
}
{'fraction_non_alphanumeric': 0.0955137481910275, 'fraction_numerical': 0.0, 'mean_word_length': 3.2343032159264933, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '4724920', 'n_tokens_mistral': 796, 'n_tokens_neox': 779, 'n_words': 156}