<commit_before>const renderGroupInformation = _.template(
  $("#group-info-template")
    .remove()
    .text()
);

const renderTeamSelection = _.template(
  $("#team-selection-template")
    .remove()
    .text()
);

String.prototype.hashCode = function () {
  let hash = 0;
  for (let i = 0; i < this.length; i++) {
    const char = this.charCodeAt(i);
    hash = (hash << 5) - hash + char;
    hash = hash & hash;
  }
  return hash;
};

window.getName = function(first, last, user) {
  let name = (first + " " + last).trim();
  if (name) {
    name += ` (${user})`;
  } else {
    name = user;
  }
  return name;
};

const createGroupSetup = function() {
  const formDialogContents = _.template($("#new-group-template").html())({});
  formDialog(
    formDialogContents,
    "Create a New Classroom",
    "OK",
    "new-group-name",
    () => createGroup($("#new-group-name").val())
  );
};

window.exportProblemCSV = (groupName, teams) =>
  apiCall("GET", "/api/v1/problems?unlocked_only=false")
    .done(function(data) {
      // problems = _.filter resp.data.problems, (problem) -> !problem.disabled
      const problems = data; // non-admin API only returns non-disabled problems as top level data array
      const outputData = [
        ["Teamname", "Member Name(s)"].concat(
          _.map(problems, problem => problem.name),
          ["Total"]
        )
      ];
      _.each(teams, function(team) {
        const members = `"${team.members
          .map(function(member) {
            return getName(
              member.firstname,
              member.lastname,
              member.username
            );
          })
          .join(", ")}"`;
        let teamData = [team.team_name, members];
        teamData = teamData.concat(
          _.map(problems, function(problem) {
            const solved = _.find(
              team.solved_problems,
              solvedProblem => solvedProblem.name === problem.name
            );
            if (solved) {
              return problem.score;
            } else {
              return 0;
            }
          })<commit_msg>Quote problem names in group export CSV<commit_after>const renderGroupInformation = _.template(
  $("#group-info-template")
    .remove()
    .text()
);

const renderTeamSelection = _.template(
  $("#team-selection-template")
    .remove()
    .text()
);

String.prototype.hashCode = function () {
  let hash = 0;
  for (let i = 0; i < this.length; i++) {
    const char = this.charCodeAt(i);
    hash = (hash << 5) - hash + char;
    hash = hash & hash;
  }
  return hash;
};

window.getName = function(first, last, user) {
  let name = (first + " " + last).trim();
  if (name) {
    name += ` (${user})`;
  } else {
    name = user;
  }
  return name;
};

const createGroupSetup = function() {
  const formDialogContents = _.template($("#new-group-template").html())({});
  formDialog(
    formDialogContents,
    "Create a New Classroom",
    "OK",
    "new-group-name",
    () => createGroup($("#new-group-name").val())
  );
};

window.exportProblemCSV = (groupName, teams) =>
  apiCall("GET", "/api/v1/problems?unlocked_only=false")
    .done(function(data) {
      // problems = _.filter resp.data.problems, (problem) -> !problem.disabled
      const problems = data; // non-admin API only returns non-disabled problems as top level data array
      const outputData = [
        ["Teamname", "Member Name(s)"].concat(
          _.map(problems, problem => `"${problem.name}"`),
          ["Total"]
        )
      ];
      _.each(teams, function(team) {
        const members = `"${team.members
          .map(function(member) {
            return getName(
              member.firstname,
              member.lastname,
              member.username
            );
          })
          .join(", ")}"`;
        let teamData = [team.team_name, members];
        teamData = teamData.concat(
          _.map(problems, function(problem) {
            const solved = _.find(
              team.solved_problems,
              solvedProblem => solvedProblem.name === problem.name
            );
            if (solved) {
              return problem.score;
            } else {
              return 0;
            }
          })
{'fraction_non_alphanumeric': 0.15517649846008055, 'fraction_numerical': 0.002369106846718787, 'mean_word_length': 2.061638868745468, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 13, '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': '502230', 'n_tokens_mistral': 1291, 'n_tokens_neox': 1267, 'n_words': 280}