<commit_before>import { handleActions } from 'redux-actions'
import moment from 'moment'

const initialState = {
  projectData: {},
  weekFrom: moment().startOf('isoWeek'),
  weekTo: moment().add(5, 'week').startOf('isoWeek'),
  isLoading: true,
  availableProjects: [
    {
      Id: 'idgoeshere',
      Name: 'goeshere'
    }
  ],
  selectedProjects: new Set()
}

const projectReducer = handleActions({
  ADD_PROJECT : (state, action) => ({
    ...state,
    projectData: {
      ...state.projectData,
      [ action.payload.newProject.uuid ] : {
        ...action.payload.newProject
      }
    }
  }),

  REMOVE_PROJECT : (state, action) => {
    const { projectId } = action.payload

    const projectData = Object.values(state.projectData).reduce((accumulator, currentValue) => {
      const { uuid } = currentValue

      if (uuid === projectId) {
        currentValue.isHidden = true;
        currentValue.values = Object.values(currentValue.values).reduce((accumulator, value) => {
          value.Hours__c = 0;
          return {
            ...accumulator,
            [ value.Week_Start__c ]: value
          };
        }, {})
      }

      return {
        ...accumulator,
        [ uuid ]: currentValue
      }
    }, {})

    return {
      ...state,
      projectData,
      selectedProjects: new Set([...state.selectedProjects].filter(projectActualId => projectActualId !== state.projectData[projectId].Id))
    }
  },

  PROJECT_UUID_TO_ID_UPDATE : (state, action) => ({
    ...state,
    projectData: {
      ...state.projectData,
      [ action.payload.uuid ] : {
        ...state.projectData[action.payload.uuid],
        Id: action.payload.projectId
      },
      selectedProjects: new Set([...state.selectedProjects, action.payload.projectId])
    }
  }),

  SET_RESOURCES : (state, action) => {<commit_msg>Better? :|<commit_after>import { handleActions } from 'redux-actions'
import moment from 'moment'

const initialState = {
  projectData: {},
  weekFrom: moment().startOf('isoWeek'),
  weekTo: moment().add(5, 'week').startOf('isoWeek'),
  isLoading: true,
  availableProjects: [
    {
      Id: 'idgoeshere',
      Name: 'goeshere'
    }
  ],
  selectedProjects: new Set()
}

const projectReducer = handleActions({
  ADD_PROJECT : (state, action) => ({
    ...state,
    projectData: {
      ...state.projectData,
      [ action.payload.newProject.uuid ] : {
        ...action.payload.newProject
      }
    }
  }),

  REMOVE_PROJECT : (state, action) => {
    const { projectId } = action.payload

    const projectData = Object.values(state.projectData).reduce((accumulator, currentValue) => {
      const { uuid } = currentValue

      if (uuid === projectId) {
        currentValue.isHidden = true;
        currentValue.values = Object.values(currentValue.values).reduce((accumulator, value) => {
          return {
            ...accumulator,
            [ value.Week_Start__c ]: {
              ...value,
              Hours__c: 0
            }
          };
        }, {})
      }

      return {
        ...accumulator,
        [ uuid ]: currentValue
      }
    }, {})

    return {
      ...state,
      projectData,
      selectedProjects: new Set([...state.selectedProjects].filter(projectActualId => projectActualId !== state.projectData[projectId].Id))
    }
  },

  PROJECT_UUID_TO_ID_UPDATE : (state, action) => ({
    ...state,
    projectData: {
      ...state.projectData,
      [ action.payload.uuid ] : {
        ...state.projectData[action.payload.uuid],
        Id: action.payload.projectId
      },
      selectedProjects: new Set([...state.selectedProjects, action.payload.projectId])
    }
  }),

  SET_RESOURCES : (state, action) => {
{'fraction_non_alphanumeric': 0.15036575453806555, 'fraction_numerical': 0.001083717149823896, 'mean_word_length': 2.2934879571810884, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 17, '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': '7041070', 'n_tokens_mistral': 1148, 'n_tokens_neox': 1123, 'n_words': 187}