<commit_before>import { selectSpecificEntityState } from './index';

export const selectNewConfigs = state => {
  const configState = selectSpecificEntityState(state, 'temperatureBreachConfiguration');
  const { byId, newIds } = configState;
  return newIds.map(id => byId[id]);
};

export const selectEditingConfigs = state => {
  const configState = selectSpecificEntityState(state, 'temperatureBreachConfiguration');
  const { byId, editingIds } = configState;
  return editingIds.map(id => byId[id]);
};

export const selectEditingConfigsByType = state => {
  const newConfigs = selectEditingConfigs(state);

  return newConfigs.reduce(
    (acc, config) => ({
      ...acc,
      [config?.type]: config,
    }),
    {}
  );
};

export const selectEditingConfigThresholds = state => {
  const editingConfigs = selectEditingConfigsByType(state);
  const {
    HOT_CONSECUTIVE: hotConsecutiveConfig = {},
    COLD_CONSECUTIVE: coldConsecutiveConfig = {},
    HOT_CUMULATIVE: hotCumulativeConfig = {},
    COLD_CUMULATIVE: coldCumulativeConfig = {},
  } = editingConfigs;

  const coldConsecutiveThreshold = hotConsecutiveConfig.minimumTemperature ?? 0 - 0.1;
  const hotConsecutiveThreshold = coldConsecutiveConfig.maximumTemperature ?? 0 + 0.1;

  const coldCumulativeThreshold = hotCumulativeConfig.minimumTemperature ?? 0 + 0.1;
  const hotCumulativeThreshold = coldCumulativeConfig.maximumTemperature ?? 0 - 0.1;

  return {
    coldConsecutiveThreshold,
    hotConsecutiveThreshold,
    hotCumulativeThreshold,
    coldCumulativeThreshold,
  };
};

export const selectNewConfigsByType = state => {
  const newConfigs = selectNewConfigs(state);

  return newConfigs.reduce(
    (acc, config) => ({
      ...acc,
      [config?.type]: config,
    }),
    {}
  );
};

export const selectNewConfigThresholds = state => {
  const newConfigs = selectNewConfigsByType(state);
  const {
    HOT_CONSECUTIVE: hotConsecutiveConfig = {},
    COLD_CONSECUTIVE: coldConsecutiveConfig = {},
    HOT_CUMULATIVE: hotCumulativeConfig = {},
    COLD_CUMULATIVE: coldCumulativeConfig = {},
  } = newConfigs;

  const coldConsecutiveThreshold = hotConsecutiveConfig.minimumTemperature ?? 0 - 0.1;
  const hotConsecutiveThreshold = coldConsecutiveConfig.maximumTemperature ?? 0 + 0.1;

  const coldCumulativeThreshold = hotCumulativeConfig.minimumTemperature ?? 0 + 0.1;
  const hotCumulativeThreshold = coldCumulativeConfig.maximumTemperature ?? 0 - 0.1;

  return {
    coldConsecutiveThreshold,
    hotConsecutiveThreshold,
    hotCumulativeThreshold,
    coldCumulativeThreshold,
  };
};<commit_msg>Add back in min 0.1 difference<commit_after>import { selectSpecificEntityState } from './index';

export const selectNewConfigs = state => {
  const configState = selectSpecificEntityState(state, 'temperatureBreachConfiguration');
  const { byId, newIds } = configState;
  return newIds.map(id => byId[id]);
};

export const selectEditingConfigs = state => {
  const configState = selectSpecificEntityState(state, 'temperatureBreachConfiguration');
  const { byId, editingIds } = configState;
  return editingIds.map(id => byId[id]);
};

export const selectEditingConfigsByType = state => {
  const newConfigs = selectEditingConfigs(state);

  return newConfigs.reduce(
    (acc, config) => ({
      ...acc,
      [config?.type]: config,
    }),
    {}
  );
};

export const selectEditingConfigThresholds = state => {
  const editingConfigs = selectEditingConfigsByType(state);
  const {
    HOT_CONSECUTIVE: hotConsecutiveConfig = {},
    COLD_CONSECUTIVE: coldConsecutiveConfig = {},
    HOT_CUMULATIVE: hotCumulativeConfig = {},
    COLD_CUMULATIVE: coldCumulativeConfig = {},
  } = editingConfigs;

  const coldConsecutiveThreshold = (hotConsecutiveConfig.minimumTemperature ?? 0) - 0.1;
  const hotConsecutiveThreshold = (coldConsecutiveConfig.maximumTemperature ?? 0) + 0.1;

  const coldCumulativeThreshold = (hotCumulativeConfig.minimumTemperature ?? 0) + 0.1;
  const hotCumulativeThreshold = (coldCumulativeConfig.maximumTemperature ?? 0) - 0.1;

  return {
    coldConsecutiveThreshold,
    hotConsecutiveThreshold,
    hotCumulativeThreshold,
    coldCumulativeThreshold,
  };
};

export const selectNewConfigsByType = state => {
  const newConfigs = selectNewConfigs(state);

  return newConfigs.reduce(
    (acc, config) => ({
      ...acc,
      [config?.type]: config,
    }),
    {}
  );
};

export const selectNewConfigThresholds = state => {
  const newConfigs = selectNewConfigsByType(state);
  const {
    HOT_CONSECUTIVE: hotConsecutiveConfig = {},
    COLD_CONSECUTIVE: coldConsecutiveConfig = {},
    HOT_CUMULATIVE: hotCumulativeConfig = {},
    COLD_CUMULATIVE: coldCumulativeConfig = {},
  } = newConfigs;

  const coldConsecutiveThreshold = (hotConsecutiveConfig.minimumTemperature ?? 0) - 0.1;
  const hotConsecutiveThreshold = (coldConsecutiveConfig.maximumTemperature ?? 0) + 0.1;

  const coldCumulativeThreshold = (hotCumulativeConfig.minimumTemperature ?? 0) + 0.1;
  const hotCumulativeThreshold = (coldCumulativeConfig.maximumTemperature ?? 0) - 0.1;

  return {
    coldConsecutiveThreshold,
    hotConsecutiveThreshold,
    hotCumulativeThreshold,
    coldCumulativeThreshold,
  };
};
{'fraction_non_alphanumeric': 0.10765687967760507, 'fraction_numerical': 0.009595087315294569, 'mean_word_length': 4.562433297758805, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 23, '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': '408847', 'n_tokens_mistral': 1695, 'n_tokens_neox': 1611, 'n_words': 297}