<commit_before>import moment from 'moment';
import 'moment-timezone';
import 'moment-business-time';

// import { distTimeBudget } from './tideGlobalMethods.js';
// import { whatIsBatch, whatIsBatchX } from './searchOps.js';
// import { round1Decimal } from './calcOps';

import Config from '/server/hardConfig.js';


SyncedCron.config({
  log: false,// Log job run details to console
  
  logger: null,// Defaults to Meteor's logging package
  
  collectionName: 'cronHistory', // Default

  utc: false,
});
  
  
SyncedCron.add({
  name: 'Daily Done Items',
  schedule: function(parser) {
    // parser is a later.parse object
    return parser.text('at 7:45 am'); // for midnight tz(Regina/Central)
  },
  job: function() {
    var numbersCrunched = runLoop(countDoneItemDay);
    return numbersCrunched;
  }
});
  
SyncedCron.start();
  
  
function countDoneItemDay(accessKey, rangeStart, rangeEnd) {
  return new Promise(function(resolve) {
    let diCount = 0;
  
    BatchDB.find({
      orgKey: accessKey,
      createdAt: { 
        $lte: new Date(rangeEnd)
      },
      items: { $elemMatch: { finishedAt: {
        $gte: new Date(rangeStart),
        $lte: new Date(rangeEnd) 
      }}}<commit_msg>CRON test<commit_after>import moment from 'moment';
import 'moment-timezone';
import 'moment-business-time';

// import { distTimeBudget } from './tideGlobalMethods.js';
// import { whatIsBatch, whatIsBatchX } from './searchOps.js';
// import { round1Decimal } from './calcOps';

import Config from '/server/hardConfig.js';


SyncedCron.config({
  log: false,// Log job run details to console
  
  logger: null,// Defaults to Meteor's logging package
  
  collectionName: 'cronHistory', // Default

  utc: false,
});
  
  
SyncedCron.add({
  name: 'Daily Done Items',
  schedule: function(parser) {
    // parser is a later.parse object
    return parser.text('at 8:00 am'); // for midnight tz(Regina/Central)
  },
  job: function() {
    var numbersCrunched = runLoop(countDoneItemDay);
    return numbersCrunched;
  }
});
  
SyncedCron.start();
  
  
function countDoneItemDay(accessKey, rangeStart, rangeEnd) {
  return new Promise(function(resolve) {
    let diCount = 0;
  
    BatchDB.find({
      orgKey: accessKey,
      createdAt: { 
        $lte: new Date(rangeEnd)
      },
      items: { $elemMatch: { finishedAt: {
        $gte: new Date(rangeStart),
        $lte: new Date(rangeEnd) 
      }}}
{'fraction_non_alphanumeric': 0.13399503722084366, 'fraction_numerical': 0.0041356492969396195, 'mean_word_length': 3.127986348122867, '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': '303646', 'n_tokens_mistral': 819, 'n_tokens_neox': 780, 'n_words': 199}