<commit_before>'use strict';



var elTable = document.getElementById('sales-table');

Product.allProducts = [];
Product.activeCart = [];
UserData.allUsers = [];

if (localStorage.getItem('activeCart') !== null) {
  console.log('Data found');
  Product.activeCart = JSON.parse(localStorage.getItem('activeCart'));
} else {
  console.log('Not found');
  alert('Your cart is empty! Please select an item to purchase.');
};

function Product(name, filePath) {
  this.name = name;
  this.filePath = filePath;
  this.inCart = 0;
  Product.allProducts.push(this);
}

function UserData(name, street, city, state, zip, phone, credit) {
  this.name = name;
  this.street = street;
  this.city = city;
  this.state = state;
  this.zip = zip;
  this.phone = phone;
  this.credit = credit;
  UserData.allUsers.push(this);
}



function createCell(row, data){
  var newTdEl = document.createElement('td');
  newTdEl.textContent = data;
  row.appendChild(newTdEl);
}

function generateCart(){
  var newTrEl = document.createElement('tr');
  createCell(newTrEl, 'dummy data');
  createCell(newTrEl, 'dummy data');
  createCell(newTrEl, 'dummy data');
  elTable.appendChild(newTrEl);
  newTrEl = document.createElement('tr');
  createCell(newTrEl, 'dummy data');
  createCell(newTrEl, 'dummy data');
  createCell(newTrEl, 'dummy data');
  elTable.appendChild(newTrEl);
}
generateCart();<commit_msg>Table works<commit_after>'use strict';

var elTable = document.getElementById('sales-table');

Product.allProducts = [];
Product.activeCart = [];
UserData.allUsers = [];

if (localStorage.getItem('activeCart') !== null) {
  console.log('Data found');
  Product.activeCart = JSON.parse(localStorage.getItem('activeCart'));
} else {
  console.log('Not found');
  alert('Your cart is empty! Please select an item to purchase.');
}

function Product(name, filePath) {
  this.name = name;
  this.filePath = filePath;
  this.inCart = 0;
  Product.allProducts.push(this);
}

function UserData(name, street, city, state, zip, phone, credit) {
  this.name = name;
  this.street = street;
  this.city = city;
  this.state = state;
  this.zip = zip;
  this.phone = phone;
  this.credit = credit;
  UserData.allUsers.push(this);
}

function createCell(row, data){
  var newTdEl = document.createElement('td');
  newTdEl.textContent = data;
  row.appendChild(newTdEl);
}

function generateCart(){
  Product.activeCart = JSON.parse(localStorage.getItem('activeCart'));
  console.log(Product.activeCart);
  for (var i in Product.activeCart){
    var newTrEl = document.createElement('tr');
    createCell(newTrEl, Product.activeCart[i].name);
    var newTdEl = document.createElement('td');
    var newImgEl = document.createElement('img');
    newImgEl.src = Product.activeCart[i].filePath;
    newTdEl.appendChild(newImgEl);
    newTrEl.appendChild(newTdEl);
    createCell(newTrEl, Product.activeCart[i].inCart);
    elTable.appendChild(newTrEl);
  }
}

generateCart();
{'fraction_non_alphanumeric': 0.1510717931269139, 'fraction_numerical': 0.0006805035726437564, 'mean_word_length': 4.798816568047338, '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': '6006598', 'n_tokens_mistral': 973, 'n_tokens_neox': 963, 'n_words': 197}