<commit_before><%- model_class = Chair -%>
<%
  monthnames = (1..12).collect{ |month| I18n.l(Date.new(1,month), format: :short_month)}
  current_year = Date.today.year
  available_years = current_year-2..current_year
%>
<div class="col-md-12 col-sm-12">
  <div class="display">
    <div class="page-header">
      <h1>
        Reporting
      </h1>
    </div>
    <div class="page-header">
      <h3>
        Spendings in 
        <div class="dropdown" style="display: inline-block">
          <a id="yearspan" class="btn btn-secondary btn-default dropdown-toggle" data-toggle="dropdown" href="#"><%= current_year %><b class="caret"></b></a>
        
          <ul class="dropdown-menu" id="year-selection">
            <% available_years.each do |year| %>
              <li><a data-year=<%= year %> href="#"> <%= year%></a></li>
            <% end %>
          </ul>
        </div>
        : <span id="total"></span> €
      </h3>
    </div>
    <div class="row">
      <div class="col-md-9">
        <div id="chart"></div>
      </div>
      <div class="col-md-3">
        <div id="ypp"></div>
      </div>
    </div>
  </div>
</div>
<div class="col-md-6 col-sm-6">
  <div class="display">
    <div class="page-header">
      <div class="row">
        <div class="col-md-6">
          <h4 id="month-detail-label">Overview for
            <div class="dropdown" style="display: inline-block">
              <a id="month-selection-header" class="btn btn-secondary btn-default dropdown-toggle" data-toggle="dropdown" href="#">Month<b class="caret"></b></a>
              <ul class="dropdown-menu" id="month-selection">
                <% (0..11).each do |month| %>
                  <li><a class=<%="month-#{month}"%> data-month=<%= month %> href="#"> <%= monthnames[month] %></a></li>
                <% end %>
              </ul>
            </div>
          </h4>
        </div>
      </div>
    </div>
    
    <div class="row">
      <div class="col-md-12">
        <div id="mpp"></div> <%# monthly per project chart%>
        <span id="mpp_no_data" style="display: none;">No data available</span>
      </div>
    </div>
  </div>
</div>  
<div class="col-md-6 col-sm-6">
  <div class="display">
    <div class="page-header">
      <h4>Drilldown for <a href="#" id="project-drilldown-label"></a><span id="project-drilldown-label-timespan"></span></h4>
    </div>
    <div class="row">
      <div class="col-md-12">
        <div id="pdd"></div>
      </div>
    </div>
    <div class="row">
      <div class="col-md-12">
        <table id="project-drilldown-table" class="table table-striped">
          <tr>
            <th>Name</th>
            <th>Contract</th>
            <th>Responsible Wimi</th>  
            <th>Salary</th>
          </tr>
        </table>
      </div>
    </div>
  </div>
</div>

<script>
  function getSum(total, num) {
    return total + parseFloat(num);
  }

  function isDataEmpty(data) {
    for(var item in data) {
      if(data[item] != 0) {
        return false;
      }
    }
    return true;
  }

  function selectMonth(month) {
    selectedMonth = month;
    monthlyPerProjectChart.resize({width: 400, height: 300});
    monthlyPerProjectChart.load({json: monthlyPerProject[month]});
    $('#month-selection-header').text($('.month-'+month).text());

    console.log(monthlyPerProject[month]);
    if(isDataEmpty(monthlyPerProject[month])) {
      $('#mpp').hide();
      $('#mpp_no_data').show();
    }
    else {
      $('#mpp').show();
      $('#mpp_no_data').hide();
    }
  }

  function parseData(data) {
    masterData = data["data"];<commit_msg>fix(reporting): insert missing unload flag at selectMonth<commit_after><%- model_class = Chair -%>
<%
  monthnames = (1..12).collect{ |month| I18n.l(Date.new(1,month), format: :short_month)}
  current_year = Date.today.year
  available_years = current_year-2..current_year
%>
<div class="col-md-12 col-sm-12">
  <div class="display">
    <div class="page-header">
      <h1>
        Reporting
      </h1>
    </div>
    <div class="page-header">
      <h3>
        Spendings in 
        <div class="dropdown" style="display: inline-block">
          <a id="yearspan" class="btn btn-secondary btn-default dropdown-toggle" data-toggle="dropdown" href="#"><%= current_year %><b class="caret"></b></a>
        
          <ul class="dropdown-menu" id="year-selection">
            <% available_years.each do |year| %>
              <li><a data-year=<%= year %> href="#"> <%= year%></a></li>
            <% end %>
          </ul>
        </div>
        : <span id="total"></span> €
      </h3>
    </div>
    <div class="row">
      <div class="col-md-9">
        <div id="chart"></div>
      </div>
      <div class="col-md-3">
        <div id="ypp"></div>
      </div>
    </div>
  </div>
</div>
<div class="col-md-6 col-sm-6">
  <div class="display">
    <div class="page-header">
      <div class="row">
        <div class="col-md-6">
          <h4 id="month-detail-label">Overview for
            <div class="dropdown" style="display: inline-block">
              <a id="month-selection-header" class="btn btn-secondary btn-default dropdown-toggle" data-toggle="dropdown" href="#">Month<b class="caret"></b></a>
              <ul class="dropdown-menu" id="month-selection">
                <% (0..11).each do |month| %>
                  <li><a class=<%="month-#{month}"%> data-month=<%= month %> href="#"> <%= monthnames[month] %></a></li>
                <% end %>
              </ul>
            </div>
          </h4>
        </div>
      </div>
    </div>
    
    <div class="row">
      <div class="col-md-12">
        <div id="mpp"></div> <%# monthly per project chart%>
        <span id="mpp_no_data" style="display: none;">No data available</span>
      </div>
    </div>
  </div>
</div>  
<div class="col-md-6 col-sm-6">
  <div class="display">
    <div class="page-header">
      <h4>Drilldown for <a href="#" id="project-drilldown-label"></a><span id="project-drilldown-label-timespan"></span></h4>
    </div>
    <div class="row">
      <div class="col-md-12">
        <div id="pdd"></div>
      </div>
    </div>
    <div class="row">
      <div class="col-md-12">
        <table id="project-drilldown-table" class="table table-striped">
          <tr>
            <th>Name</th>
            <th>Contract</th>
            <th>Responsible Wimi</th>  
            <th>Salary</th>
          </tr>
        </table>
      </div>
    </div>
  </div>
</div>

<script>
  function getSum(total, num) {
    return total + parseFloat(num);
  }

  function isDataEmpty(data) {
    for(var item in data) {
      if(data[item] != 0) {
        return false;
      }
    }
    return true;
  }

  function selectMonth(month) {
    selectedMonth = month;
    monthlyPerProjectChart.resize({width: 400, height: 300});
    monthlyPerProjectChart.load({json: monthlyPerProject[month], unload: true});
    $('#month-selection-header').text($('.month-'+month).text());

    console.log(monthlyPerProject[month]);
    if(isDataEmpty(monthlyPerProject[month])) {
      $('#mpp').hide();
      $('#mpp_no_data').show();
    }
    else {
      $('#mpp').show();
      $('#mpp_no_data').hide();
    }
  }

  function parseData(data) {
    masterData = data["data"];
{'fraction_non_alphanumeric': 0.20444505797901713, 'fraction_numerical': 0.011595803423522915, 'mean_word_length': 2.250336473755047, 'pattern_counts': {'":': 0, '<': 235, '<?xml version=': 0, '>': 235, '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': '1765809', 'n_tokens_mistral': 2551, 'n_tokens_neox': 2459, 'n_words': 463}