<commit_before><%!
  import json
%>

$(function () {
  function showTooltip(x, y, contents) {
    $('<div id="tooltip">' + contents + '</div>').css( {
      position: 'absolute',
      display: 'none',
      top: y + 5,
      left: x + 5,
      border: '1px solid #fdd',
      padding: '2px',
      'background-color': '#fee',
      opacity: 0.90
    }).appendTo("body").fadeIn(200);
  }
      
  /* -------------------------------- Grade detail bars -------------------------------- */
  var colors = [$.color.parse("#E8B800"), $.color.parse("#A0CEFA"), $.color.parse("#BD3738"), $.color.parse("#429A2E")];
  //var colors = [$.color.parse("#1B2045"), $.color.parse("#557a00"), $.color.parse("#F5600"), $.color.parse("#FEBA2C")];
  //var colors = [$.color.parse("#E7C856"), $.color.parse("#CD462E"), $.color.parse("#B01732"), $.color.parse("#41192A")];
  //var colors = [$.color.parse("#434F5E"), $.color.parse("#BEF731"), $.color.parse("#FB5455"), $.color.parse("#44C4B7")];
  //var colors = [$.color.parse("#147A7D"), $.color.parse("#C0C900"), $.color.parse("#C9005B"), $.color.parse("#FCF9A5")];
      
      
      
  var series = [];
  var ticks = []; //These are the indices and x-axis labels for the data
  var bottomTicks = []; //Labels on the bottom
  var detail_tooltips = {}; //This an dictionary mapping from 'section' -> array of detail_tooltips
  var droppedScores = []; //These are the datapoints to indicate assignments which aren't factored into the total score
  detail_tooltips['Dropped Scores'] = [];
  <%
  tickIndex = 1
  sectionSpacer = 0.5
  sectionIndex = 0
  %>
  %for section in grade_summary:
    %if 'subscores' in section: ##This is for sections like labs or homeworks, with several smaller components and a total
      series.push({label: "${section['category']}",
        data: ${ json.dumps( [[i + tickIndex, score['percentage']] for i,score in enumerate(section['subscores'])] ) },
        color: colors[${sectionIndex}].toString(),
      });
      ticks = ticks.concat( ${ json.dumps( [[i + tickIndex, score['label'] ] for i,score in enumerate(section['subscores'])] ) } );
      bottomTicks.push( [ ${tickIndex + len(section['subscores'])/2}, "${section['category']}" ] );
      detail_tooltips["${section['category']}"] = ${ json.dumps([score['summary'] for score in section['subscores']]  ) };
          
      droppedScores = droppedScores.concat(${ json.dumps( [[tickIndex + index, 0.05] for index in section['dropped_indices']]) });
      <% dropExplanation = "The lowest {0} {1} scores are dropped".format( len(section['dropped_indices']), section['category'] ) %>
      detail_tooltips['Dropped Scores'] = detail_tooltips['Dropped Scores'].concat( ${json.dumps( [dropExplanation] * len(section['dropped_indices']) )} );
          
      <% tickIndex += len(section['subscores']) + sectionSpacer %>
          
      ##Now put on the aggregate score
      series.push({label: "${section['category']} Total",
        data: [[${tickIndex}, ${section['totalscore']['score']}]],
        color: colors[${sectionIndex}].toString(),
      });
      ticks = ticks.concat( [ [${tickIndex}, "${section['totallabel']}"] ] );
      detail_tooltips["${section['category']} Average"] = [ "${section['totalscore']['summary']}" ];
      <% tickIndex += 1 + sectionSpacer %>
          
    %else: ##This is for sections like midterm or final, which have no smaller components<commit_msg>Fixed bug where tooltip of profile graph totals wouldn't show up<commit_after><%!
  import json
%>

$(function () {
  function showTooltip(x, y, contents) {
    $('<div id="tooltip">' + contents + '</div>').css( {
      position: 'absolute',
      display: 'none',
      top: y + 5,
      left: x + 5,
      border: '1px solid #fdd',
      padding: '2px',
      'background-color': '#fee',
      opacity: 0.90
    }).appendTo("body").fadeIn(200);
  }
      
  /* -------------------------------- Grade detail bars -------------------------------- */
  var colors = [$.color.parse("#E8B800"), $.color.parse("#A0CEFA"), $.color.parse("#BD3738"), $.color.parse("#429A2E")];
  //var colors = [$.color.parse("#1B2045"), $.color.parse("#557a00"), $.color.parse("#F5600"), $.color.parse("#FEBA2C")];
  //var colors = [$.color.parse("#E7C856"), $.color.parse("#CD462E"), $.color.parse("#B01732"), $.color.parse("#41192A")];
  //var colors = [$.color.parse("#434F5E"), $.color.parse("#BEF731"), $.color.parse("#FB5455"), $.color.parse("#44C4B7")];
  //var colors = [$.color.parse("#147A7D"), $.color.parse("#C0C900"), $.color.parse("#C9005B"), $.color.parse("#FCF9A5")];
      
      
      
  var series = [];
  var ticks = []; //These are the indices and x-axis labels for the data
  var bottomTicks = []; //Labels on the bottom
  var detail_tooltips = {}; //This an dictionary mapping from 'section' -> array of detail_tooltips
  var droppedScores = []; //These are the datapoints to indicate assignments which aren't factored into the total score
  detail_tooltips['Dropped Scores'] = [];
  <%
  tickIndex = 1
  sectionSpacer = 0.5
  sectionIndex = 0
  %>
  %for section in grade_summary:
    %if 'subscores' in section: ##This is for sections like labs or homeworks, with several smaller components and a total
      series.push({label: "${section['category']}",
        data: ${ json.dumps( [[i + tickIndex, score['percentage']] for i,score in enumerate(section['subscores'])] ) },
        color: colors[${sectionIndex}].toString(),
      });
      ticks = ticks.concat( ${ json.dumps( [[i + tickIndex, score['label'] ] for i,score in enumerate(section['subscores'])] ) } );
      bottomTicks.push( [ ${tickIndex + len(section['subscores'])/2}, "${section['category']}" ] );
      detail_tooltips["${section['category']}"] = ${ json.dumps([score['summary'] for score in section['subscores']]  ) };
          
      droppedScores = droppedScores.concat(${ json.dumps( [[tickIndex + index, 0.05] for index in section['dropped_indices']]) });
      <% dropExplanation = "The lowest {0} {1} scores are dropped".format( len(section['dropped_indices']), section['category'] ) %>
      detail_tooltips['Dropped Scores'] = detail_tooltips['Dropped Scores'].concat( ${json.dumps( [dropExplanation] * len(section['dropped_indices']) )} );
          
      <% tickIndex += len(section['subscores']) + sectionSpacer %>
          
      ##Now put on the aggregate score
      series.push({label: "${section['category']} Total",
        data: [[${tickIndex}, ${section['totalscore']['score']}]],
        color: colors[${sectionIndex}].toString(),
      });
      ticks = ticks.concat( [ [${tickIndex}, "${section['totallabel']}"] ] );
      detail_tooltips["${section['category']} Total"] = [ "${section['totalscore']['summary']}" ];
      <% tickIndex += 1 + sectionSpacer %>
          
    %else: ##This is for sections like midterm or final, which have no smaller components
{'fraction_non_alphanumeric': 0.21816329500800466, 'fraction_numerical': 0.027652452335904527, 'mean_word_length': 3.385449904275686, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 19, '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': '6465320', 'n_tokens_mistral': 2263, 'n_tokens_neox': 2103, 'n_words': 499}