<commit_before>'use strict';

function handleSubmitReview (event) {

  event.preventDefault();
  var form = event.target;
  var reviewUpdate = form.userWineReview.value;
  console.log(reviewUpdate);
  form.reset();

  var section = document.getElementById('reviewBox');

  var pTag = document.createElement('p');
  section.appendChild(pTag);
  pTag.textContent = (reviewUpdate);

    users[currentUserIndex].reviews.push(reviewUpdate);
  }
  try {
    localStorage.users = JSON.stringify(users);
    console.log('users', users);
  }
  catch (error) {
    console.log('something went wrong', error);
  }

//
function handleUserBio (event){
  event.preventDefault();
  usersBio.textContent = '';
  var form = event.target;
  var userBioUpdate = form.userBio.value;
  console.log(userBioUpdate);
  users[currentUserIndex].bio = userBioUpdate;
  form.reset();
  populateBio();
  try {
    localStorage.users = JSON.stringify(users);
    console.log('users', users);
  }
  catch (error) {
    console.log('something went wrong', error);
  }

}
function populateBio(){
  var bioUpdate = document.getElementById('usersBio');
  var text = document.createTextNode(users[currentUserIndex].bio);
  var list = document.createElement('li');
  bioUpdate.appendChild(list);
  list.appendChild(text);
}
populateBio();

function profilePicSubmitHandler(event){

  event.preventDefault();
  var form = event.target;
  console.log(event.target);
  var imageURL = form.imageURL.value;
  var image = document.getElementById('profile-pic');
  image.src = users[currentUserIndex].profilePic;
  users[currentUserIndex].profilePic = imageURL;
  try {
    localStorage.users = JSON.stringify(users);
    console.log('users', users);
  }
  catch (error) {
    console.log('something went wrong', error);
  }
}
function profilePic() {
  var image = document.getElementById('profile-pic');
  image.src = users[currentUserIndex].profilePic;
}
profilePic();

checkBoxGenerator(wines, 'Whats your favorite wine color?', 'favwine');
checkBoxGenerator(wineList, 'What kinds of wines do you like to drink?', 'wineTypes');
checkBoxGenerator(wineries, 'What are your favorites wineries?');

var setProfile = document.getElementById('set-profile');<commit_msg>fixed profile pic update handler to include profilePic function call on submit so that you do not have to click submit twice to populate new profile pic<commit_after>'use strict';

function handleSubmitReview (event) {

  event.preventDefault();
  var form = event.target;
  var reviewUpdate = form.userWineReview.value;
  console.log(reviewUpdate);
  form.reset();

  var section = document.getElementById('reviewBox');

  var pTag = document.createElement('p');
  section.appendChild(pTag);
  pTag.textContent = (reviewUpdate);

    users[currentUserIndex].reviews.push(reviewUpdate);
  }
  try {
    localStorage.users = JSON.stringify(users);
    console.log('users', users);
  }
  catch (error) {
    console.log('something went wrong', error);
  }

//
function handleUserBio (event){
  event.preventDefault();
  usersBio.textContent = '';
  var form = event.target;
  var userBioUpdate = form.userBio.value;
  console.log(userBioUpdate);
  users[currentUserIndex].bio = userBioUpdate;
  form.reset();
  populateBio();
  try {
    localStorage.users = JSON.stringify(users);
    console.log('users', users);
  }
  catch (error) {
    console.log('something went wrong', error);
  }

}
function populateBio(){
  var bioUpdate = document.getElementById('usersBio');
  var text = document.createTextNode(users[currentUserIndex].bio);
  var list = document.createElement('li');
  bioUpdate.appendChild(list);
  list.appendChild(text);
}
populateBio();

function profilePicSubmitHandler(event){

  event.preventDefault();
  var form = event.target;
  console.log(event.target);
  var imageURL = form.imageURL.value;
  var image = document.getElementById('profile-pic');
  image.src = users[currentUserIndex].profilePic;
  users[currentUserIndex].profilePic = imageURL;
  try {
    localStorage.users = JSON.stringify(users);
    console.log('users', users);
  }
  catch (error) {
    console.log('something went wrong', error);
  }
  profilePic();
}
function profilePic() {
  var image = document.getElementById('profile-pic');
  image.src = users[currentUserIndex].profilePic;
}
profilePic();

checkBoxGenerator(wines, 'Whats your favorite wine color?', 'favwine');
checkBoxGenerator(wineList, 'What kinds of wines do you like to drink?', 'wineTypes');
checkBoxGenerator(wineries, 'What are your favorites wineries?');

var setProfile = document.getElementById('set-profile');
{'fraction_non_alphanumeric': 0.13415959991302456, 'fraction_numerical': 0.0, 'mean_word_length': 4.852417302798982, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '5747086', 'n_tokens_mistral': 1402, 'n_tokens_neox': 1348, 'n_words': 304}