var config = require('../config');
var logger = require('lib/logger')(module);
var startTime = Date.parse(config.get('startTime'));
var finishTime = Date.parse(config.get('finishTime'));
var Problem = require('models/problem').Problem;

module.exports = function (req, res, next) {
    Problem.count({},function(err,count){
        if(count-1 === req.user.problemHistory.length){
            logger.info("finish");
            res.render('finish');
        }
        else{
            if (Date.now() < startTime) {
                res.locals.timeStart = Date.parse(config.get('startTime'));
                res.render('start');
            }
            else {
                if (Date.now() > finishTime) {
                    logger.info("finish");
                    res.render('finish');
                }
                else  next();
            }
        }
    });
}
@@ -337,10 +337,8 @@
 ount
--1
  ===

fix bug at check finish