<commit_before>import { api } from '../../utils';

const reduceUserChallengesToIdAndField = (challenge, field) =>
  Object.values(challenge.userChallenges).reduce(
    (userChallenges, userChallenge) => [
      ...userChallenges,
      {
        id: userChallenge.id,
        [field]: userChallenge[field]
      }
    ],
    []
  );

const getEvaluableChallenges = () => api.get('/challenges/for_evaluation');
const postSaveComments = challenge =>
  api.post(
    '/user_challenges/comments',
    {
      user_challenges: reduceUserChallengesToIdAndField(challenge, 'comments')
    },
    `Comments were not able to be saved for ${challenge.spot.row}${challenge
      .spot.file}'s challenge'`
  );
const postSavePlaces = challenge =>
  api.post(
    '/user_challenges/places',
    { user_challenges: reduceUserChallengesToIdAndField(challenge, 'place') },
    `Places were not able to be saved for ${challenge.spot.row}${challenge.spot
      .file}'s challenge'`
  );
const putSubmitForEvaluation = challenge =>
  api.put(
    `/challenges/${challenge.id}/submit_for_approval`,
    {},
    `${challenge.spot.row}${challenge.spot
      .file}'s challenge was not able to be submitted for approval`<commit_msg>remove extra 's<commit_after>import { api } from '../../utils';

const reduceUserChallengesToIdAndField = (challenge, field) =>
  Object.values(challenge.userChallenges).reduce(
    (userChallenges, userChallenge) => [
      ...userChallenges,
      {
        id: userChallenge.id,
        [field]: userChallenge[field]
      }
    ],
    []
  );

const getEvaluableChallenges = () => api.get('/challenges/for_evaluation');
const postSaveComments = challenge =>
  api.post(
    '/user_challenges/comments',
    {
      user_challenges: reduceUserChallengesToIdAndField(challenge, 'comments')
    },
    `Comments were not able to be saved for ${challenge.spot.row}${challenge
      .spot.file}'s challenge`
  );
const postSavePlaces = challenge =>
  api.post(
    '/user_challenges/places',
    { user_challenges: reduceUserChallengesToIdAndField(challenge, 'place') },
    `Places were not able to be saved for ${challenge.spot.row}${challenge.spot
      .file}'s challenge`
  );
const putSubmitForEvaluation = challenge =>
  api.put(
    `/challenges/${challenge.id}/submit_for_approval`,
    {},
    `${challenge.spot.row}${challenge.spot
      .file}'s challenge was not able to be submitted for approval`
{'fraction_non_alphanumeric': 0.1368899917287014, 'fraction_numerical': 0.0, 'mean_word_length': 3.5555555555555554, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 15, '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': '4433772', 'n_tokens_mistral': 832, 'n_tokens_neox': 741, 'n_words': 147}