<commit_before>var rankingService = module.exports = {};

var _ = require('lodash');
var q = require('q');
var moment = require('moment');

var placingService = require('../placing/placingService');
var greyhoundService = require('../greyhound/greyhoundService');
var mongoService = require('../mongoService');
var RankingSystem = require('./rankingSystem').model;
var Ranking = require('./ranking').model;
var rankingSystemService = require('./rankingSystemService');
var eventService = require('../event/eventService');
var batchService = require('../batch/batchService');
var baseService = require('../baseService');

baseService.addStandardServiceMethods(rankingService, Ranking);

rankingService.calculateRankings = function(periodStart, periodEnd, rankingSystemRef){
    periodStart = rankingService.defaultPeriodStart(periodStart);
    periodEnd = rankingService.defaultPeriodEnd(periodEnd);
    return rankingService.getRankingSystem(rankingSystemRef).then(function(rankingSystem){
        rankingSystem = rankingSystem.toObject();
        rankingSystem = rankingService.addPeriodCriteria(periodStart, periodEnd, rankingSystem);
        rankingSystem = rankingService.insertCommonCriteria(rankingSystem);
        console.log(JSON.stringify(rankingSystem, null, 2));
        return rankingService.convertPointAllotmentsToPlacingsPoints(rankingSystem.pointAllotments)
            .then(function(pointPlacings){
                var rankings = rankingService.sumPlacingsIntoRankings(pointPlacings, true);
                rankings = rankings.map(function(ranking){
                    ranking.rankingSystemRef = rankingSystem._id.toString();
                    return ranking;
                });
                return rankingService.addRankingPosition(rankings);<commit_msg>removed log<commit_after>var rankingService = module.exports = {};

var _ = require('lodash');
var q = require('q');
var moment = require('moment');

var placingService = require('../placing/placingService');
var greyhoundService = require('../greyhound/greyhoundService');
var mongoService = require('../mongoService');
var RankingSystem = require('./rankingSystem').model;
var Ranking = require('./ranking').model;
var rankingSystemService = require('./rankingSystemService');
var eventService = require('../event/eventService');
var batchService = require('../batch/batchService');
var baseService = require('../baseService');

baseService.addStandardServiceMethods(rankingService, Ranking);

rankingService.calculateRankings = function(periodStart, periodEnd, rankingSystemRef){
    periodStart = rankingService.defaultPeriodStart(periodStart);
    periodEnd = rankingService.defaultPeriodEnd(periodEnd);
    return rankingService.getRankingSystem(rankingSystemRef).then(function(rankingSystem){
        rankingSystem = rankingSystem.toObject();
        rankingSystem = rankingService.addPeriodCriteria(periodStart, periodEnd, rankingSystem);
        rankingSystem = rankingService.insertCommonCriteria(rankingSystem);
        return rankingService.convertPointAllotmentsToPlacingsPoints(rankingSystem.pointAllotments)
            .then(function(pointPlacings){
                var rankings = rankingService.sumPlacingsIntoRankings(pointPlacings, true);
                rankings = rankings.map(function(ranking){
                    ranking.rankingSystemRef = rankingSystem._id.toString();
                    return ranking;
                });
                return rankingService.addRankingPosition(rankings);
{'fraction_non_alphanumeric': 0.11352587932513583, 'fraction_numerical': 0.00028595939376608524, 'mean_word_length': 4.491365777080063, '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': '4712569', 'n_tokens_mistral': 887, 'n_tokens_neox': 837, 'n_words': 149}