File tree Expand file tree Collapse file tree 3 files changed +9
-22
lines changed Expand file tree Collapse file tree 3 files changed +9
-22
lines changed Original file line number Diff line number Diff line change @@ -88,8 +88,9 @@ core.getProblem = function(keyword, cb) {
8888 if ( e ) return cb ( e ) ;
8989
9090 keyword = Number ( keyword ) || keyword ;
91+ const metaFid = file . exist ( keyword ) ? Number ( file . meta ( keyword ) . id ) : NaN ;
9192 const problem = problems . find ( function ( x ) {
92- return x . fid === keyword || x . name === keyword || x . slug === keyword ;
93+ return x . fid === keyword || x . name === keyword || x . slug === keyword || x . fid === metaFid ;
9394 } ) ;
9495 if ( ! problem ) return cb ( 'Problem not found!' ) ;
9596 core . next . getProblem ( problem , cb ) ;
Original file line number Diff line number Diff line change @@ -28,16 +28,14 @@ plugin.getProblem = function(problem, cb) {
2828 const k = h . KEYS . problem ( problem ) ;
2929 const _problem = cache . get ( k ) ;
3030 if ( _problem ) {
31- // do not hit problem without html tags in desc ( <pre> always exists for presenting testcase)
32- if ( ! _problem . desc . includes ( " <pre>" ) ) {
31+ if ( ! _problem . desc . includes ( ' <pre>' ) ) {
32+ // do not hit problem without html tags in desc ( <pre> always exists for presenting testcase)
3333 log . debug ( 'cache discarded for being no longer valid: ' + k + '.json' ) ;
34- }
35- // do not hit problem without likes & dislikes (logic will be improved in new lib)
36- else if ( ! [ 'likes' , 'dislikes' ] . every ( p => p in _problem ) ) {
34+ } else if ( ! [ 'likes' , 'dislikes' ] . every ( p => p in _problem ) ) {
35+ // do not hit problem without likes & dislikes (logic will be improved in new lib)
3736 log . debug ( 'cache discarded for being too old: ' + k + '.json' ) ;
38- }
39- // cache hit
40- else {
37+ } else {
38+ // cache hit
4139 log . debug ( 'cache hit: ' + k + '.json' ) ;
4240 _ . extendOwn ( problem , _problem ) ;
4341 return cb ( null , problem ) ;
Original file line number Diff line number Diff line change @@ -2,17 +2,5 @@ ${comment.start}
22${ comment.line} @lc app=${ app} id=${ fid} lang=${ lang}
33${ comment.line}
44${ comment.line} [${ fid} ] ${ name}
5- ${ comment.line}
6- ${ comment.line} ${ link}
7- ${ comment.line}
8- ${ comment.line} ${ category}
9- ${ comment.line} ${ level} (${ percent} %)
10- ${ comment.line} Likes: ${ likes}
11- ${ comment.line} Dislikes: ${ dislikes}
12- ${ comment.line} Total Accepted: ${ totalAC}
13- ${ comment.line} Total Submissions: ${ totalSubmit}
14- ${ comment.line} Testcase Example: ${ testcase}
15- ${ comment.line}
16- { { desc.forEach(function(x) { } }${ comment.line} ${ x}
17- { { } ) }}${ comment.end}
5+ ${ comment.end}
186${ code}
You can’t perform that action at this time.
0 commit comments