-import {mongoCallbacksCount} from '../mongo/MongooseCallbackManager'
 import {GROUPS} from '../../client/lib/informaticsGroups'
+
 import {START_SUBMITS_DATE} from '../api/dashboard'
+
 import send from '../metrics/graphite'
 import notify from '../metrics/notify'
+
+import FindMistake from '../models/FindMistake'
 import Result from "../models/result"
+
+import {mongoCallbacksCount} from '../mongo/MongooseCallbackManager'
 
 sendGraphite = () ->
     queries = 

    await sendWarnings()
    await sendGraphite()
    await sendWebSocketsCount2Graphite()

    metrics = {"websockets": mongoCallbacksCount()}
    await send(metrics)

sendPendingFindMistakes = () ->
    metrics = {"pendingFindMistakes": await FindMistake.findNotApprovedCount()}
    await send(metrics)

sendWarnings = () ->
    endDate = new Date(new Date() - 5 * 60 * 1000)
    query = {ps: 1, lastSubmitTime: {$lt: endDate}, total: 1}
