<commit_before>/**
 * Database event hooks.
 * These are called on certain update, insertion, or removal events.
 */

/**
 * Create an example marking scheme, with marks, for a new user.
 */
Meteor.users.after.insert(function(userId, doc) {
  let example = {
      "name": "Example",
      "description": "This is an example marking scheme, using rubrics and pre-set comments. Click to view example marks!",
      "creator": doc._id,
      "createdAt": new Date(),
      "aspects": [{
        "aspect": "Report Structure",
        "rows": [{
          "criteria": "Excellent structure that meets all requirements.",
          "criteriaValue": 10<commit_msg>Purge older activity, close #21<commit_after>/**
 * Database event hooks.
 * These are called on certain update, insertion, or removal events.
 */

/**
 * Remove older activity entries when a new one is added.
 */
Activities.after.insert(function(userId) {
  let log = Activities.find({relevantTo: userId}, {sort:{performedAt: 1}}),
    array = log.fetch(),
    count = log.count();
  console.log(count);
  for (var i = 0; i < count - 5; i++) {
    console.log('removing', array[i]);
    Activities.remove(array[i]._id);
  }
});

/**
 * Create an example marking scheme, with marks, for a new user.
 */
Meteor.users.after.insert(function(userId, doc) {
  let example = {
      "name": "Example",
      "description": "This is an example marking scheme, using rubrics and pre-set comments. Click to view example marks!",
      "creator": doc._id,
      "createdAt": new Date(),
      "aspects": [{
        "aspect": "Report Structure",
        "rows": [{
          "criteria": "Excellent structure that meets all requirements.",
          "criteriaValue": 10
{'fraction_non_alphanumeric': 0.14352392065344224, 'fraction_numerical': 0.005250875145857643, 'mean_word_length': 3.0736342042755345, 'pattern_counts': {'":': 18, '<': 4, '<?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': '4770952', 'n_tokens_mistral': 518, 'n_tokens_neox': 496, 'n_words': 170}