<commit_before>app.factory('amazonFactory', function($http, addProductFactory, $location, getProductFactory){
  return {
    getAmazon : (value) => {
      console.log("value from Factory", value);
       return $http.post('/api/amazon',
        {params: value
                 })
      .then((things) => {
          console.log(things.data);
          let searchResults = [];
          for (var i = 0; i < things.data.length; i++) {
            let searchProduct = {};
            //set the amazon search category to a largerlocal search category
            if (value.searchIndex === "ArtsAndCrafts" || value.searchIndex === "HomeGarden"){
              searchProduct.category = "Home";
            } else if (value.searchIndex === "Fashion") {
              searchProduct.category = "Clothing";
            } else if (value.searchIndex === "Grocery") {
              searchProduct.category = "Food";
            } else {
            searchProduct.category = value.searchIndex;
            }
            //parse the product name
            searchProduct.name = things.data[i].ItemAttributes[0].Title[0];
            console.log("title", searchProduct.name);
            //parse the company name
            if (things.data[i].ItemAttributes[0].Brand === undefined) {
              continue;
            } else {
              searchProduct.company = things.data[i].ItemAttributes[0].Brand[0];
              console.log("company", searchProduct.company);
            }
            //parse the amazon purchase link
            searchProduct.link = things.data[i].DetailPageURL[0];
            console.log("link", searchProduct.link);
            //parse the amazon unique product id
            searchProduct.amazonUniqueId = things.data[i].ASIN[0];
            console.log("ASIN", searchProduct.amazonUniqueId);
            //stamp the search date on the product object for later use
            searchProduct.addDate = new Date();
            console.log("date", searchProduct.addDate);
            //if the product has images, gather one
            if(things.data[i].ImageSets) {
              searchProduct.image = things.data[i].ImageSets[0].ImageSet[0].LargeImage[0].URL[0];
              console.log("productImage", searchProduct.image);
            } else {
              continue;
            }
            if(things.data[i].ItemAttributes[0].ListPrice) {
              searchProduct.price = (things.data[i].ItemAttributes[0].ListPrice[0].Amount[0] / 100);
              console.log("price", searchProduct.price);<commit_msg>fixed bug so now prices show 2 decimals<commit_after>app.factory('amazonFactory', function($http, addProductFactory, $location, getProductFactory){
  return {
    getAmazon : (value) => {
      console.log("value from Factory", value);
       return $http.post('/api/amazon',
        {params: value
                 })
      .then((things) => {
          console.log(things.data);
          let searchResults = [];
          for (var i = 0; i < things.data.length; i++) {
            let searchProduct = {};
            //set the amazon search category to a largerlocal search category
            if (value.searchIndex === "ArtsAndCrafts" || value.searchIndex === "HomeGarden"){
              searchProduct.category = "Home";
            } else if (value.searchIndex === "Fashion") {
              searchProduct.category = "Clothing";
            } else if (value.searchIndex === "Grocery") {
              searchProduct.category = "Food";
            } else {
            searchProduct.category = value.searchIndex;
            }
            //parse the product name
            searchProduct.name = things.data[i].ItemAttributes[0].Title[0];
            console.log("title", searchProduct.name);
            //parse the company name
            if (things.data[i].ItemAttributes[0].Brand === undefined) {
              continue;
            } else {
              searchProduct.company = things.data[i].ItemAttributes[0].Brand[0];
              console.log("company", searchProduct.company);
            }
            //parse the amazon purchase link
            searchProduct.link = things.data[i].DetailPageURL[0];
            console.log("link", searchProduct.link);
            //parse the amazon unique product id
            searchProduct.amazonUniqueId = things.data[i].ASIN[0];
            console.log("ASIN", searchProduct.amazonUniqueId);
            //stamp the search date on the product object for later use
            searchProduct.addDate = new Date();
            console.log("date", searchProduct.addDate);
            //if the product has images, gather one
            if(things.data[i].ImageSets) {
              searchProduct.image = things.data[i].ImageSets[0].ImageSet[0].LargeImage[0].URL[0];
              console.log("productImage", searchProduct.image);
            } else {
              continue;
            }
            if(things.data[i].ItemAttributes[0].ListPrice) {
              searchProduct.price = (things.data[i].ItemAttributes[0].ListPrice[0].Amount[0] / 100).toFixed(2);
              //parseFloat(Math.round(num3 * 100) / 100).toFixed(2);
              console.log("price", searchProduct.price);
{'fraction_non_alphanumeric': 0.12823483970645036, 'fraction_numerical': 0.009269988412514484, 'mean_word_length': 1.995373048004627, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, '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': '5379340', 'n_tokens_mistral': 1367, 'n_tokens_neox': 1326, 'n_words': 283}