diff --git a/lib/core.js b/lib/core.js index 74362f78..8f8c807f 100644 --- a/lib/core.js +++ b/lib/core.js @@ -88,8 +88,9 @@ core.getProblem = function(keyword, cb) { if (e) return cb(e); keyword = Number(keyword) || keyword; + const metaFid = file.exist(keyword) ? Number(file.meta(keyword).id) : NaN; const problem = problems.find(function(x) { - return x.fid === keyword || x.name === keyword || x.slug === keyword; + return x.fid === keyword || x.name === keyword || x.slug === keyword || x.fid === metaFid; }); if (!problem) return cb('Problem not found!'); core.next.getProblem(problem, cb); diff --git a/lib/plugins/cache.js b/lib/plugins/cache.js index 3c2194e7..c224a27e 100644 --- a/lib/plugins/cache.js +++ b/lib/plugins/cache.js @@ -28,16 +28,14 @@ plugin.getProblem = function(problem, cb) { const k = h.KEYS.problem(problem); const _problem = cache.get(k); if (_problem) { - // do not hit problem without html tags in desc (
 always exists for presenting testcase)
-    if (!_problem.desc.includes("
")) {
+    if (!_problem.desc.includes('
')) {
+      // do not hit problem without html tags in desc (
 always exists for presenting testcase)
       log.debug('cache discarded for being no longer valid: ' + k + '.json');
-    }
-    // do not hit problem without likes & dislikes (logic will be improved in new lib)
-    else if (!['likes', 'dislikes'].every(p => p in _problem)) {
+    } else if (!['likes', 'dislikes'].every(p => p in _problem)) {
+      // do not hit problem without likes & dislikes (logic will be improved in new lib)
       log.debug('cache discarded for being too old: ' + k + '.json');
-    }
-    // cache hit
-    else {
+    } else {
+      // cache hit
       log.debug('cache hit: ' + k + '.json');
       _.extendOwn(problem, _problem);
       return cb(null, problem);
diff --git a/templates/detailed.tpl b/templates/detailed.tpl
index c8ac653c..22ea0a6b 100644
--- a/templates/detailed.tpl
+++ b/templates/detailed.tpl
@@ -2,17 +2,5 @@ ${comment.start}
 ${comment.line} @lc app=${app} id=${fid} lang=${lang}
 ${comment.line}
 ${comment.line} [${fid}] ${name}
-${comment.line}
-${comment.line} ${link}
-${comment.line}
-${comment.line} ${category}
-${comment.line} ${level} (${percent}%)
-${comment.line} Likes:    ${likes}
-${comment.line} Dislikes: ${dislikes}
-${comment.line} Total Accepted:    ${totalAC}
-${comment.line} Total Submissions: ${totalSubmit}
-${comment.line} Testcase Example:  ${testcase}
-${comment.line}
-{{ desc.forEach(function(x) { }}${comment.line} ${x}
-{{ }) }}${comment.end}
+${comment.end}
 ${code}