<commit_before>import Immutable from 'immutable';
import { ImmutableUtils, REQUEST, SUCCESS, FAILURE } from '@ethical-jobs/redux';
import * as UserActions from './actions';

// Initial state
export const initialState = Immutable.fromJS({
  fetching: false,
  error: false,
  filters: {},
  entities: {},
  results: [],
  result: false,
});

/**
 * User reducer
 * @author <NAME> <<EMAIL>>
 */
export default function reducer(state = initialState, action = {}) {
  switch (action.type) {
    case UserActions.CLEAR_ENTITIES:
      return ImmutableUtils.clearEntities(state);

    case UserActions.UPDATE_FILTERS:
      return ImmutableUtils.updateFilters(state, action.payload);

    case REQUEST(UserActions.FETCH_COLLECTION):
    case REQUEST(UserActions.FETCH_ENTITY):
    case REQUEST(UserActions.CREATE):
    case REQUEST(UserActions.UPDATE):
    case REQUEST(UserActions.PATCH):
    case REQUEST(UserActions.ARCHIVE):
    case REQUEST(UserActions.RESTORE):
      return ImmutableUtils.mergeRequest(state);

    case SUCCESS(UserActions.FETCH_ENTITY):
    case SUCCESS(UserActions.CREATE):
    case SUCCESS(UserActions.UPDATE):
    case SUCCESS(UserActions.PATCH):
    case SUCCESS(UserActions.ARCHIVE):
    case SUCCESS(UserActions.RESTORE):
      return ImmutableUtils.mergeSuccess(state, action.payload);

    case SUCCESS(UserActions.FETCH_COLLECTION):
      return ImmutableUtils.mergeCollectionSuccess(state, action.payload);
<commit_msg>Give proper treatment to archive action<commit_after>import Immutable from 'immutable';
import { ImmutableUtils, REQUEST, SUCCESS, FAILURE } from '@ethical-jobs/redux';
import * as UserActions from './actions';

// Initial state
export const initialState = Immutable.fromJS({
  fetching: false,
  error: false,
  filters: {},
  entities: {},
  results: [],
  result: false,
});

/**
 * User reducer
 * @author <NAME> <<EMAIL>>
 */
export default function reducer(state = initialState, action = {}) {
  switch (action.type) {
    case UserActions.CLEAR_ENTITIES:
      return ImmutableUtils.clearEntities(state);

    case UserActions.UPDATE_FILTERS:
      return ImmutableUtils.updateFilters(state, action.payload);

    case REQUEST(UserActions.FETCH_COLLECTION):
    case REQUEST(UserActions.FETCH_ENTITY):
    case REQUEST(UserActions.CREATE):
    case REQUEST(UserActions.UPDATE):
    case REQUEST(UserActions.PATCH):
    case REQUEST(UserActions.ARCHIVE):
    case REQUEST(UserActions.RESTORE):
      return ImmutableUtils.mergeRequest(state);

    case SUCCESS(UserActions.FETCH_ENTITY):
    case SUCCESS(UserActions.CREATE):
    case SUCCESS(UserActions.UPDATE):
    case SUCCESS(UserActions.PATCH):
    case SUCCESS(UserActions.RESTORE):
      return ImmutableUtils.mergeSuccess(state, action.payload);

    case SUCCESS(UserActions.ARCHIVE):
      return ImmutableUtils.archiveSuccess(state, action.payload);

    case SUCCESS(UserActions.FETCH_COLLECTION):
      return ImmutableUtils.mergeCollectionSuccess(state, action.payload);

{'fraction_non_alphanumeric': 0.11036789297658862, 'fraction_numerical': 0.0, 'mean_word_length': 4.601123595505618, 'pattern_counts': {'":': 0, '<': 9, '<?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': '5275676', 'n_tokens_mistral': 918, 'n_tokens_neox': 883, 'n_words': 186}