<commit_before>
// Categories
var servings = Object.keys(user.servings);

$(document).ready(function() {

  $('.up-arrow').click(function() {
    console.log('whatsupdog');
    var category = '#' + $(this).parent().attr('id') + 'Number';
    var currentNum = +$(category).val();
    $(category).val(currentNum + 1);
  });

  $('.down-arrow').click(function() {
    var category = '#' + $(this).parent().attr('id') + 'Number';
    var currentNum = +$(category).val();
    if (currentNum > 0) {
      $(category).val(currentNum - 1);
    }
  });

  // Set cookies
  $('#continue-page-2').click(function() {
    // Grab values and set cookies
    for (serving in servings) {
      ingredient = servings[serving];
      var servingValue = $('#' + ingredient + 'Number').val();
      if (Cookies.enabled) {
        Cookies.set(ingredient, servingValue);
      }
      user.servings[serving] = +servingValue;
    }
    setPage3();
  });

  // Repopulate fields from cookies
  repopulatePage2()
});

function repopulatePage2() {
  for (serving in servings) {
    var ingredient = servings[serving];
    var oldServing = Cookies.get(ingredient);
    if (oldServing) { $("#" + ingredient + "Number").val(oldServing); }
  }
}
<commit_msg>really got it to work<commit_after>
// Categories
var servings = Object.keys(user.servings);

$(document).ready(function() {

  $('.up-arrow').click(function() {
    console.log('whatsupdog');
    var category = '#' + $(this).parent().attr('id') + 'Number';
    var currentNum = +$(category).val();
    $(category).val(currentNum + 1);
  });

  $('.down-arrow').click(function() {
    var category = '#' + $(this).parent().attr('id') + 'Number';
    var currentNum = +$(category).val();
    if (currentNum > 0) {
      $(category).val(currentNum - 1);
    }
  });

  // Set cookies
  $('#continue-page-2').click(function() {
    // Grab values and set cookies
    for (serving in servings) {
      ingredient = servings[serving];
      var servingValue = $('#' + ingredient + 'Number').val();
      if (Cookies.enabled) {
        Cookies.set(ingredient, servingValue);
      }
      user.servings[ingredient] = +servingValue;
    }
    setPage3();
  });

  // Repopulate fields from cookies
  repopulatePage2()
});

function repopulatePage2() {
  for (serving in servings) {
    var ingredient = servings[serving];
    var oldServing = Cookies.get(ingredient);
    if (oldServing) { $("#" + ingredient + "Number").val(oldServing); }
  }
}

{'fraction_non_alphanumeric': 0.19294689906769355, 'fraction_numerical': 0.005674908796108634, 'mean_word_length': 3.1759729272419626, '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': '96129', 'n_tokens_mistral': 827, 'n_tokens_neox': 792, 'n_words': 156}