<commit_before>- if @food_entries.length > 0
  .overall
    %h4  Yhteenveto päivästä
    = "Energiaa " + @stats.energy.round(1).to_s + " kcal"
    %br
    = "Hiilihydraattia " + @stats.carbs.round(1).to_s + " g"
    %br
    = "Proteiinia " + @stats.protein.round(1).to_s + " g"
    %br
    = "Rasvaa " + @stats.fat.round(1).to_s + " g"

  %h3 Syödyt

  .food_entries
    - @food_entries.each do |f|
      .food_entry
        = "#{f.consumable.name} (#{quantity_unit(f)})"
        = link_to 'Poista', f, :method => :delete

  /= will_paginate @food_entries

- else
  %p Et ole syönyt vielä mitään tänään.<commit_msg>really added the pie chart<commit_after>- if @food_entries.length > 0
  .overall
    %h4  Yhteenveto päivästä
    = "Energiaa " + @stats.energy.round(1).to_s + " kcal"
    %br
    = "Hiilihydraattia " + @stats.carbs.round(1).to_s + " g"
    %br
    = "Proteiinia " + @stats.protein.round(1).to_s + " g"
    %br
    = "Rasvaa " + @stats.fat.round(1).to_s + " g"

  %h3 Syödyt

  .food_entries
    - @food_entries.each do |f|
      .food_entry
        = "#{f.consumable.name} (#{quantity_unit(f)})"
        = link_to 'Poista', f, :method => :delete

  /= will_paginate @food_entries

  %br

  :javascript
    $(function() {
      // http://www.highcharts.com/ref/#lang
      Highcharts.setOptions({
      	lang: {
      		months: #{I18n.t("date.month_names").drop(1).inspect},
      		weekdays: #{I18n.t("date.day_names").inspect},
      		loading: "Ladataan..."
      		// todo: set decimalPoint and thousandsSep
      	}
      });
    
      new Highcharts.Chart({
        chart: {
          renderTo: "energy_chart",
          plotBackgroundColor: null,
          plotBorderWidth: null,
          plotShadow: false
        },
        tooltip: {
           formatter: function() {
              return '<b>'+ this.point.name +'</b>: '+ this.y +' %';
           }
        },
        plotOptions: {
          pie: {
            dataLabels: {
              enabled: true,
              distance: 15,
              formatter: function() {
                return '<b>'+ this.point.name +'</b>: '+ this.y +' %';
              }
            }
          }
        },
        credits: {
          enabled: false
        },
        title: {
          text: "Kokonaisenergian jakautuminen"
        },
        series: [{
          type: 'pie',
          name: "test",
          data: [
            ['Hiilihydraatti', #{(@stats.carbs*4/@stats.energy*100).round(1)}],
            ['Proteiini', #{(@stats.protein*4/@stats.energy*100).round(1)}],
            ['Rasva', #{(@stats.fat*9/@stats.energy*100).round(1)}]
          ]
        }]
      });
    });
  
  #energy_chart{ :style => "width: 300px; height: 240px;" }

- else
  %p Et ole syönyt vielä mitään tänään.
{'fraction_non_alphanumeric': 0.16636528028933092, 'fraction_numerical': 0.015189873417721518, 'mean_word_length': 1.8109756097560976, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 12, 'https://': 0, 'lorem ipsum': 0, 'www.': 1, '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': '967433', 'n_tokens_mistral': 1064, 'n_tokens_neox': 995, 'n_words': 172}