var logger = require('lib/logger')(module);
var Problem = require('models/problem').Problem;

module.exports = function (req, res, next) {
    if (req.user.problems.length === 0) {
        logger.info("Finish: nothing to solve");
        if (req.headers['x-requested-with'] == 'XMLHttpRequest') {
            return res.json({status: "Success", message: 'Finished', reload: true});
        } else {
            return res.render('finish');
        }
    }
}

@@ -85,16 +85,47 @@
 Problem;
+%0Avar _ = require('underscore');
 %0A%0Amodule
@@ -171,36 +171,154 @@
     
-if (req.user.problems.length
+var toSolve = _.reduce(req.user.problems, function(memo, problem) %7B%0A        return problem.forHints ? memo : memo + 1;%0A    %7D, 0);%0A%0A    if (toSolve
  ===
@@ -592,16 +592,45 @@
       %7D%0A
+    %7D else %7B%0A        next();%0A
     %7D%0A%7D%0A

Fix checkFinished