<commit_before>/* Copyright (c) 2012 Association France-ioi, MIT License http://opensource.org/licenses/MIT */
!function () {

var contestID;
var contestFolder;
var contestStatus;
var fullFeedback;
var nextQuestionAuto;
var newInterface;
var teamID = 0;
var teamPassword = "";
var questionsData = {};
var questionsKeyToID = {};
var questionsToGrade = [];
var scores = {};
var questionUnlockedLevels = {};
var bonusScore = 0;
var ffTeamScore = 0;
var ffMaxTeamScore = 0; // fullFeedback versions
var teamScore = 0;
var maxTeamScore = 0;
var sending = false;
var answersToSend = {};
var answers = {};
var defaultAnswers = {};
var currentQuestionKey = "";
// SID is initialized to the empty string so that its encoding in an AJAX query
// is predictable (rather than being either '' or 'null').
var SID = '';
var hasAnsweredQuestion = false;
var hasDisplayedContestStats = false;
var delaySendingAttempts = 60000;
var nbSubmissions = 0;
var t = i18n.t;

var logToConsole = function(logStr) {
  if (window.console) {
    console.error(logStr);
  }
}

window.logError = function(error, errormsg) {
  var logStr = error+(errormsg ? ' '+errormsg : '');
  logToConsole(logStr);
  $.post('logError.php', {errormsg: logStr}, function(data) {
    if (!data || !data.success) {
      logToConsole('error from logError.php')
    }
  }, 'json').fail(function() {
    logToConsole('error calling logError.php');
  });
}

/**
 * Old IE versions does not implement the Array.indexOf function
 * Setting it in Array.prototype.indexOf makes IE crash
 * So the graders are using this inArray function
 *
 * TODO: is it still used?
 *
 * @param {array} arr
 * @param {type} value<commit_msg>add question ID in errors<commit_after>/* Copyright (c) 2012 Association France-ioi, MIT License http://opensource.org/licenses/MIT */
!function () {

var contestID;
var contestFolder;
var contestStatus;
var fullFeedback;
var nextQuestionAuto;
var newInterface;
var teamID = 0;
var teamPassword = "";
var questionsData = {};
var questionsKeyToID = {};
var questionsToGrade = [];
var scores = {};
var questionUnlockedLevels = {};
var bonusScore = 0;
var ffTeamScore = 0;
var ffMaxTeamScore = 0; // fullFeedback versions
var teamScore = 0;
var maxTeamScore = 0;
var sending = false;
var answersToSend = {};
var answers = {};
var defaultAnswers = {};
var currentQuestionKey = "";
// SID is initialized to the empty string so that its encoding in an AJAX query
// is predictable (rather than being either '' or 'null').
var SID = '';
var hasAnsweredQuestion = false;
var hasDisplayedContestStats = false;
var delaySendingAttempts = 60000;
var nbSubmissions = 0;
var t = i18n.t;

var logToConsole = function(logStr) {
  if (window.console) {
    console.error(logStr);
  }
}

window.logError = function(error, errormsg) {
  var logStr = (currentQuestionKey ? currentQuestionKey+': ' : '')+error+(errormsg ? ' '+errormsg : '');
  logToConsole(logStr);
  $.post('logError.php', {errormsg: logStr}, function(data) {
    if (!data || !data.success) {
      logToConsole('error from logError.php')
    }
  }, 'json').fail(function() {
    logToConsole('error calling logError.php');
  });
}

/**
 * Old IE versions does not implement the Array.indexOf function
 * Setting it in Array.prototype.indexOf makes IE crash
 * So the graders are using this inArray function
 *
 * TODO: is it still used?
 *
 * @param {array} arr
 * @param {type} value
{'fraction_non_alphanumeric': 0.1289659224441833, 'fraction_numerical': 0.010575793184488837, 'mean_word_length': 4.336990595611285, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '1750150', 'n_tokens_mistral': 1105, 'n_tokens_neox': 1050, 'n_words': 341}