<commit_before><!doctype html>
   <html>
         <script src="/js/jquery-1.11.0.js" ></script>
         <script src="/js/financeful.js" ></script>
         <script src="/js/bootstrap.js" ></script>
         <link href="css/bootstrap.min.css" rel="stylesheet">
         <link href="css/bootstrap-theme.min.css" rel="stylesheet">
         <link href="css/financeful.css" rel="stylesheet"> 

         	<p> Financeful </p> 

     
       <table style="width:20%" align="center">
     	<tr> 
    		<td > <a href="{{add_purchase}}" id="add"> ADD </a> </td> 
    		<th> <a href="{{view}}"> VIEW </a> </th>
    		<th> <a href="{{set}}"> SET </a> </th>
          </tr>
         </table>	
         <br> 

      <script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
       <div id="piechart" style="width: 900px; height: 500px;" align="center"></div>

      <div id = "pie_chart_category" align = "center"> 
      <script>
    
      var categories=[];
      var moods =[];
      var mood_count=new Array(5).join('0').split('').map(parseFloat);
      var food_mood_count=new Array(5).join('0').split('').map(parseFloat);

      var prices= new Array(5).join('0').split('').map(parseFloat);

      var a = 0;
      for(a = 0; a < prices.length; ++a) 
        prices[a] = 0;
      for(a = 0; a < mood_count.length; ++a) {
        mood_count[a] = 0;
        food_mood_count[a] = 0;
      }
        $.getJSON("../data.json", function(data) { 
          //Categories chart
          console.log(data);
          var i,j;
          for(i=0; i < data.categories.length; ++i) {
            categories[i] = data.categories[i].category;
            for(j=0; j < data.purchases.length; ++j) {
              if(data.purchases[j].category === categories[i]) {
                prices[i] = prices[i] + +data.purchases[j].price;
              }  
            }
          }

          //Moods chart
          for(i=0; i < data.moods.length; ++i) {
            moods[i] = data.moods[i].mood;
            for(j=0; j < data.purchases.length; ++j) {
              if(data.purchases[j].mood === moods[i]) {
                mood_count[i] = mood_count[i] + 1;
                if(data.purchases[j].category == "Food")
                  food_mood_count[i] = food_mood_count[i] + 1;
              }  
            }
          }

          console.log(food_mood_count[2]);



         google.charts.load('current', {'packages':['corechart']});
          google.charts.setOnLoadCallback(drawChart1);
                 function drawChart1() {
    

        //Categories chart
        var data1 = google.visualization.arrayToDataTable([
        [ 'Category', 'Amount Spent'],
          [categories[0], prices[0]],
          [categories[1], prices[1]],
          [categories[2], prices[2]],
          [categories[3], prices[3]]
        ]);  

        var options1 = {
          title: 'My Spending Report',
          backgroundColor: 'white',
          is3D: true,
        };

        var chart1 = new google.visualization.PieChart(document.getElementById('piechart'));

        chart1.draw(data1, options1);
      };

        });

     
      </script>
      </div>
      <br>

      <div id = "pie_chart_category2" align = "center"> 
    <script type="text/javascript">
      google.charts.load('current', {'packages':['corechart']});
      google.charts.setOnLoadCallback(drawChart);
      function drawChart() {

        var data2 = google.visualization.arrayToDataTable([
          ['Mood', 'Occurrences per month'],
          [moods[0],     mood_count[0]],
          [moods[1],     mood_count[1]],
          [moods[2],  mood_count[2]],<commit_msg>dsd Merge branch 'master' of https://github.com/rickylieu/financeful<commit_after><!doctype html>
   <html>
         <script src="/js/jquery-1.11.0.js" ></script>
         <script src="/js/financeful.js" ></script>
         <script src="/js/bootstrap.js" ></script>
         <link href="css/bootstrap.min.css" rel="stylesheet">
         <link href="css/bootstrap-theme.min.css" rel="stylesheet">
         <link href="css/financeful.css" rel="stylesheet"> 

         	<p> Financeful </p> 

     
       <table style="width:20%" align="center">
     	<tr> 
    		<td > <a href="{{add_purchase}}" id="add"> ADD </a> </td> 
    		<th> <a href="{{view}}"> VIEW </a> </th>
    		<th> <a href="{{set}}"> SET </a> </th>
          </tr>
         </table>	
         <br> 

      <script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
       <div id="piechart" style="width: 900px; height: 500px;" align="center"></div>

      <div id = "pie_chart_category" align = "center"> 
      <script>
    
      var spending_array = [];
      var categories=[];
      var moods =[];
      var mood_count=new Array(5).join('0').split('').map(parseFloat);
      var food_mood_count=new Array(5).join('0').split('').map(parseFloat);

      var prices= new Array(5).join('0').split('').map(parseFloat);

      var a = 0;
      for(a = 0; a < prices.length; ++a) 
        prices[a] = 0;
      for(a = 0; a < mood_count.length; ++a) {
        mood_count[a] = 0;
        food_mood_count[a] = 0;
      }
        $.getJSON("../data.json", function(data) { 
          //Categories chart
          console.log(data);
          var i,j;
          for(i=0; i < data.categories.length; ++i) {
            categories[i] = data.categories[i].category;
            for(j=0; j < data.purchases.length; ++j) {
              if(data.purchases[j].category === categories[i]) {
                prices[i] = prices[i] + +data.purchases[j].price;
              }  
            }
          }

          //Moods chart
          for(i=0; i < data.moods.length; ++i) {
            moods[i] = data.moods[i].mood;
            for(j=0; j < data.purchases.length; ++j) {
              if(data.purchases[j].mood === moods[i]) {
                mood_count[i] = mood_count[i] + 1;
                if(data.purchases[j].category == "Food")
                  food_mood_count[i] = food_mood_count[i] + 1;
              }  
            }
         }
       spending_array[0] = ['Category', 'Amount Spent'];
         for(i=0; i < data.categories.length; ++i) {
          spending_array[i+1] = [categories[i], prices[i]];
         }
         /*onsole.log(food_mood_count[2]);      
            spending_array[1] = [categories[0], prices[0]];
        spending_array[2] = [categories[1], prices[1]];
        spending_array[3] = [categories[2], prices[2]];
        spending_array[4] = [categories[3], prices[3]];*/



         google.charts.load('current', {'packages':['corechart']});
          google.charts.setOnLoadCallback(drawChart1);
                 function drawChart1() {
        

        //Categories chart
        var data1 = google.visualization.arrayToDataTable(
          spending_array
          /*
          [ 
        [ 'Category', 'Amount Spent'],
          [categories[0], prices[0]],
          [categories[1], prices[1]],
          [categories[2], prices[2]],
          [categories[3], prices[3]]
        ]*/);  

        var options1 = {
          title: 'My Spending Report',
          backgroundColor: 'white',
          is3D: true,
        };

        var chart1 = new google.visualization.PieChart(document.getElementById('piechart'));

        chart1.draw(data1, options1);
      };

        });

     
      </script>
      </div>
      <br>

      <div id = "pie_chart_category2" align = "center"> 
    <script type="text/javascript">
      google.charts.load('current', {'packages':['corechart']});
      google.charts.setOnLoadCallback(drawChart);
      function drawChart() {

        var data2 = google.visualization.arrayToDataTable([
          ['Mood', 'Occurrences per month'],
          [moods[0],     mood_count[0]],
          [moods[1],     mood_count[1]],
          [moods[2],  mood_count[2]],
{'fraction_non_alphanumeric': 0.17710059926048705, 'fraction_numerical': 0.016192783373709038, 'mean_word_length': 1.9700870882241575, 'pattern_counts': {'":': 0, '<': 98, '<?xml version=': 0, '>': 85, 'https://': 3, 'lorem ipsum': 0, 'www.': 2, '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': '1319786', 'n_tokens_mistral': 2670, 'n_tokens_neox': 2565, 'n_words': 448}