<commit_before>import { EloRankings, Ratings, RatingsTemplates } from '../../lib/database/Ratings.js';
import { Currencies } from '../../lib/database/Currencies.js';
import { GraphData } from '../../lib/database/GraphData.js'


Meteor.methods({
  'averageEloWallet': function() {
    var currencies = Currencies.find().fetch();
    var allRatings = [];
    for (c in currencies) {
      var ratings = EloRankings.find({currencyId: currencies[c]._id}).fetch();
      var length = ratings.length;
      var ratingArray = [];
      var final = 0;

      for (r in ratings) {
        ratingArray.push(ratings[r].ranking);
        //console.log(parseInt(r) + 1);
        //console.log(length);
        //console.log("----------");
        if(parseInt(r) + 1 == length) {
          //average the total array
          var sum = _.reduce(ratingArray, function(memo, num){ return memo + num; }, 0);
          final = Math.floor(sum / (length));
          allRatings.push(final);
          Currencies.upsert({_id: currencies[c]._id}, {$set: {
            walletRanking: final
          }})
        }
      }
    }
    GraphData.upsert({_id: "elodata"}, {$set: {
      minElo: _.min(allRatings),
      maxElo: _.max(allRatings)
    }})
     //{catagory: "wallet"}
    //for (w in wallets) {
      //console.log(wallets[w].currencyName + " " + wallets[w].ranking);

  },
  'tabulateElo': function() {
    //Import Elo ranking logic
    var Elo = require('../libs/elo.js');
    //Update the EloRankings db to make sure all currencies are included
    //each question for each currency needs an elo ranking - each question is a different game

    //Initiate elo ranking at 400
    var currencies = Currencies.find().fetch();
    var questions = RatingsTemplates.find().fetch();
    for (item in currencies) {
      var currency = currencies[item];
      for (q in questions) {
        //create unique ID for each ELO ranking 'player'
        var qid = questions[q]._id;
        var cid = currency._id;
        var id = qid.toString().substr(qid.length - 5) + cid.toString().substr(cid.length - 5);
        try {<commit_msg>problem: min and max elo data not catagory specific<commit_after>import { EloRankings, Ratings, RatingsTemplates } from '../../lib/database/Ratings.js';
import { Currencies } from '../../lib/database/Currencies.js';
import { GraphData } from '../../lib/database/GraphData.js'


Meteor.methods({
  'averageEloWallet': function() {
    var currencies = Currencies.find().fetch();
    var allRatings = [];
    for (c in currencies) {
      var ratings = EloRankings.find({currencyId: currencies[c]._id}).fetch();
      var length = ratings.length;
      var ratingArray = [];
      var final = 0;

      for (r in ratings) {
        ratingArray.push(ratings[r].ranking);
        //console.log(parseInt(r) + 1);
        //console.log(length);
        //console.log("----------");
        if(parseInt(r) + 1 == length) {
          //average the total array
          var sum = _.reduce(ratingArray, function(memo, num){ return memo + num; }, 0);
          final = Math.floor(sum / (length));
          allRatings.push(final);
          Currencies.upsert({_id: currencies[c]._id}, {$set: {
            walletRanking: final
          }})
        }
      }
    }
    GraphData.upsert({_id: "elodata"}, {$set: {
      walletMinElo: _.min(allRatings),
      walletMaxElo: _.max(allRatings)
    }})
     //{catagory: "wallet"}
    //for (w in wallets) {
      //console.log(wallets[w].currencyName + " " + wallets[w].ranking);

  },
  'tabulateElo': function() {
    //Import Elo ranking logic
    var Elo = require('../libs/elo.js');
    //Update the EloRankings db to make sure all currencies are included
    //each question for each currency needs an elo ranking - each question is a different game

    //Initiate elo ranking at 400
    var currencies = Currencies.find().fetch();
    var questions = RatingsTemplates.find().fetch();
    for (item in currencies) {
      var currency = currencies[item];
      for (q in questions) {
        //create unique ID for each ELO ranking 'player'
        var qid = questions[q]._id;
        var cid = currency._id;
        var id = qid.toString().substr(qid.length - 5) + cid.toString().substr(cid.length - 5);
        try {
{'fraction_non_alphanumeric': 0.15472846441947566, 'fraction_numerical': 0.004213483146067416, 'mean_word_length': 2.3939634630659254, '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': '4376608', 'n_tokens_mistral': 1378, 'n_tokens_neox': 1304, 'n_words': 338}