<commit_before>//
//
function resetDraftPlayerList() {
  $(".draftPlayer").empty();
}

function updateDraftPlayerList(playerList){
  //
  var $draftList = $("#draftList");
  console.table(playerList);
  //
  for (var player in playerList) {
    // construct divs for players in list
    var $player = $("<div>", {id: playerList[player].playerid, class: "draftPlayer"});
    var $name = $("<div>", {class: "playerName"});
    var $headerContainer = $("<div>", {class: "headerContainer"})
    //
    // APPEND NAME to PLAYER
    $name.text(playerList[player].namefirst + " " + playerList[player].namelast);
    $player.append($name);
    //
    // STATS HEADER
    var battingColHeaders = ["YEAR","HITS","RUNS","H.RUNS","RBI","S.BASES", "DRAFT"];
    for (var i = 0; i < 7; i++){
      $div = $("<div>", {class: "headerName"});
      $div.text(battingColHeaders[i]);
      $headerContainer.append($div);
    }
    $player.append($headerContainer);
    // STATS
    //
    for (var year in playerList[player].batting) {
      var yearNum = playerList[player].batting[year].yearid;
      var hits = playerList[player].batting[year].h;
      var runs = playerList[player].batting[year].r;
      var h_runs = playerList[player].batting[year].hr;
      var rbis = playerList[player].batting[year].rbi;
      var s_bases = playerList[player].batting[year].sb;

      var $statsContainer = $("<div>", {class: "statsContainer"})
      var $year = $("<div>", {class: "year stats"}).text(yearNum);
      var $hits = $("<div>", {class: "hits stats"}).text(hits);
      var $runs = $("<div>", {class: "runs stats"}).text(runs);
      var $h_runs = $("<div>", {class: "h_runs stats"}).text(h_runs);
      var $rbis = $("<div>", {class: "rbis stats"}).text(rbis);
      var $s_bases = $("<div>", {class: "s_bases stats"}).text(s_bases);
      var $draft_button = $("<button>", {class: "button-primary draft_button stats", onclick: "draftPlayer(\"" + playerList[player].playerid + "\"," + yearNum + ")"}).text("draft");

      $statsContainer.append($year);
      $statsContainer.append($hits);
      $statsContainer.append($runs);
      $statsContainer.append($h_runs);
      $statsContainer.append($rbis);
      $statsContainer.append($s_bases);
      $statsContainer.append($draft_button);
      $player.append($statsContainer);
    }

  
    //
    // ADD TO PAGE with CLICK FUNCTION to COLLAPSE HISTORY

    $draftList.append($player);
    //
    // ADD EVENT TO COLLAPSE ON CLICK
    createClickEvent_collapse($player, $name);
  }
}

function createClickEvent_collapse(playerDiv, nameDiv) {
  nameDiv.click(function(){
    //
    //
    playerDiv.find(".stats").css("display", "none");<commit_msg>added pitching stats on draft page<commit_after>//
//
function resetDraftPlayerList() {
  $(".draftPlayer").empty();
}

function updateDraftPlayerList(playerList){
  //
  var $draftList = $("#draftList");
  console.table(playerList);
  //
  for (var player in playerList) {
    // construct divs for players in list
    var $player = $("<div>", {id: playerList[player].playerid, class: "draftPlayer"});
    var $name = $("<div>", {class: "playerName"});
    var $headerContainer = $("<div>", {class: "headerContainer"})
    var $pitchingheaderContainer = $("<div>", {class: "headerContainer"})
    //
    // APPEND NAME to PLAYER
    $name.text(playerList[player].namefirst + " " + playerList[player].namelast);
    $player.append($name);
    //
    // STATS HEADER
    var battingColHeaders = ["YEAR","HITS","RUNS","H.RUNS","RBI","S.BASES", "DRAFT"];
    for (var i = 0; i < 7; i++){
      $div = $("<div>", {class: "headerName"});
      $div.text(battingColHeaders[i]);
      $headerContainer.append($div);
    }
    $player.append($headerContainer);
    // STATS
    //
    for (var year in playerList[player].batting) {
      var yearNum = playerList[player].batting[year].yearid;
      var hits = playerList[player].batting[year].h;
      var runs = playerList[player].batting[year].r;
      var h_runs = playerList[player].batting[year].hr;
      var rbis = playerList[player].batting[year].rbi;
      var s_bases = playerList[player].batting[year].sb;

      var $statsContainer = $("<div>", {class: "statsContainer"})
      var $year = $("<div>", {class: "year stats"}).text(yearNum);
      var $hits = $("<div>", {class: "hits stats"}).text(hits);
      var $runs = $("<div>", {class: "runs stats"}).text(runs);
      var $h_runs = $("<div>", {class: "h_runs stats"}).text(h_runs);
      var $rbis = $("<div>", {class: "rbis stats"}).text(rbis);
      var $s_bases = $("<div>", {class: "s_bases stats"}).text(s_bases);
      var $draft_button = $("<button>", {class: "button-primary draft_button stats", onclick: "draftPlayer(\"" + playerList[player].playerid + "\"," + yearNum + ")"}).text("draft");

      $statsContainer.append($year);
      $statsContainer.append($hits);
      $statsContainer.append($runs);
      $statsContainer.append($h_runs);
      $statsContainer.append($rbis);
      $statsContainer.append($s_bases);
      $statsContainer.append($draft_button);
      $player.append($statsContainer);
    }
    var pitchingColHeaders = ["YEAR","WINS","WALKS","K","ERA","SAVES", "DRAFT"];
    for (var i = 0; i < 7; i++){
      $div = $("<div>", {class: "headerName"});
      $div.text(pitchingColHeaders[i]);
      $pitchingheaderContainer.append($div);
    }
    $player.append($pitchingheaderContainer);

    for (var year in playerList[player].pitching) {
      var yearNum = playerList[player].pitching[year].yearid;
      var wins = playerList[player].pitching[year].w;
      var bb = playerList[player].pitching[year].bb;
      var k = playerList[player].pitching[year].so;
      var era = playerList[player].pitching[year].era;
      var sv = playerList[player].pitching[year].sv;

      var $statsContainer = $("<div>", {class: "statsContainer"})
      var $year = $("<div>", {class: "year stats"}).text(yearNum);
      var $wins = $("<div>", {class: "wins stats"}).text(wins);
      var $bb = $("<div>", {class: "bb stats"}).text(bb);
      var $k = $("<div>", {class: "k stats"}).text(k);
      var $era = $("<div>", {class: "era stats"}).text(era);
      var $sv = $("<div>", {class: "sv stats"}).text(sv);
      var $draft_button = $("<button>", {class: "button-primary draft_button stats", onclick: "draftPitcher(\"" + playerList[player].playerid + "\"," + yearNum + ")"}).text("draft");

      $statsContainer.append($year);
      $statsContainer.append($wins);
      $statsContainer.append($bb);
      $statsContainer.append($k);
      $statsContainer.append($era);
      $statsContainer.append($sv);
      $statsContainer.append($draft_button);
      $player.append($statsContainer);
    }
    //
    // ADD TO PAGE with CLICK FUNCTION to COLLAPSE HISTORY

    $draftList.append($player);
    //
    // ADD EVENT TO COLLAPSE ON CLICK
    createClickEvent_collapse($player, $name);
  }
}

function createClickEvent_collapse(playerDiv, nameDiv) {
  nameDiv.click(function(){
    //
    //
    playerDiv.find(".stats").css("display", "none");
{'fraction_non_alphanumeric': 0.20050977060322855, 'fraction_numerical': 0.0008496176720475786, 'mean_word_length': 3.574481865284974, 'pattern_counts': {'":': 0, '<': 40, '<?xml version=': 0, '>': 37, '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': '4500411', 'n_tokens_mistral': 2372, 'n_tokens_neox': 2299, 'n_words': 459}