<commit_before>(function() {

function cookieQuestionCount() {
  var completedQuestions = docCookies.keys();
  return completedQuestions.length;
}

var questionCount = cookieQuestionCount() > 0 ? cookieQuestionCount() : 0;

function incrementSessionQuestionCount() {
    questionCount += 1;
}

// add check for cookies here
var answerArray = questions.map(function(questionObject) {
  questionObject.answer = false;
  return questionObject;
})

function updateAnswers(answer, questionNo) {
  answerArray[questionNo - 2].answer = answer;
}

function updateDoughnut(questionNo) {
  var topicPercentages = topics.map(function(topic) {
    var topicAnswers = answerArray.filter(function(answerObject) {
      return answerObject.topic === topic;
    });
    var trueTopicAnswers = topicAnswers.filter(function(answerObject) {
      return answerObject.answer === true;
    });
    var percentageTrueAnswers = trueTopicAnswers.length / topicAnswers.length;
    var percentageOfDoughnut = percentageTrueAnswers * 100 / 5;
    var rObj = {};
    rObj[topic] = percentageOfDoughnut;
    return rObj;
  }).slice(0,5);
  var currentTopicPercentage = topicPercentages.filter(function(topicObject) {
    return Object.keys(topicObject)[0] === questions[questionNo - 2].topic;
  })
  var valueOfCurrentTopicPercentage = currentTopicPercentage[0][Object.keys(currentTopicPercentage[0]])
  console.log(valueOfCurrentTopicPercentage);
  if (questions[questionNo - 2].topic !== questions[questionNo - 1].topic) {
    config.data.labels.push('data #' + config.data.labels.length);
    config.data.datasets[0].data.push(20);
    config.data.datasets[0].backgroundColor.push();
    window.myDoughnut.update();
  }<commit_msg>ban this sick filth<commit_after>(function() {

function cookieQuestionCount() {
  var completedQuestions = docCookies.keys();
  return completedQuestions.length;
}

var questionCount = cookieQuestionCount() > 0 ? cookieQuestionCount() : 0;

function incrementSessionQuestionCount() {
    questionCount += 1;
}

// add check for cookies here
var answerArray = questions.map(function(questionObject) {
  questionObject.answer = false;
  return questionObject;
})

function updateAnswers(answer, questionNo) {
  answerArray[questionNo - 2].answer = answer;
}

function updateDoughnut(questionNo) {
  var topicPercentages = topics.map(function(topic) {
    var topicAnswers = answerArray.filter(function(answerObject) {
      return answerObject.topic === topic;
    });
    var trueTopicAnswers = topicAnswers.filter(function(answerObject) {
      return answerObject.answer === true;
    });
    var percentageTrueAnswers = trueTopicAnswers.length / topicAnswers.length;
    var percentageOfDoughnut = percentageTrueAnswers * 100 / 5;
    var rObj = {};
    rObj[topic] = percentageOfDoughnut;
    return rObj;
  }).slice(0,5);
  var currentTopicPercentage = topicPercentages.filter(function(topicObject) {
    return Object.keys(topicObject)[0] === questions[questionNo - 2].topic;
  })
  var valueOfCurrentTopicPercentage = currentTopicPercentage[0][Object.keys(currentTopicPercentage[0])]
  if (questions[questionNo - 2].topic !== questions[questionNo - 1].topic) {
    config.data.labels.push('data #' + config.data.labels.length);
    config.data.datasets[0].data.push(valueOfCurrentTopicPercentage);
    config.data.datasets[0].backgroundColor.push();
    window.myDoughnut.update();
  }
{'fraction_non_alphanumeric': 0.12069473064468648, 'fraction_numerical': 0.011186340889019724, 'mean_word_length': 4.8788927335640135, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '1953414', 'n_tokens_mistral': 1029, 'n_tokens_neox': 981, 'n_words': 182}