File tree 3 files changed +9
-22
lines changed
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) {
88
88
if ( e ) return cb ( e ) ;
89
89
90
90
keyword = Number ( keyword ) || keyword ;
91
+ const metaFid = file . exist ( keyword ) ? Number ( file . meta ( keyword ) . id ) : NaN ;
91
92
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 ;
93
94
} ) ;
94
95
if ( ! problem ) return cb ( 'Problem not found!' ) ;
95
96
core . next . getProblem ( problem , cb ) ;
Original file line number Diff line number Diff line change @@ -28,16 +28,14 @@ plugin.getProblem = function(problem, cb) {
28
28
const k = h . KEYS . problem ( problem ) ;
29
29
const _problem = cache . get ( k ) ;
30
30
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)
33
33
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)
37
36
log . debug ( 'cache discarded for being too old: ' + k + '.json' ) ;
38
- }
39
- // cache hit
40
- else {
37
+ } else {
38
+ // cache hit
41
39
log . debug ( 'cache hit: ' + k + '.json' ) ;
42
40
_ . extendOwn ( problem , _problem ) ;
43
41
return cb ( null , problem ) ;
Original file line number Diff line number Diff line change @@ -2,17 +2,5 @@ ${comment.start}
2
2
${ comment.line} @lc app=${ app} id=${ fid} lang=${ lang}
3
3
${ comment.line}
4
4
${ 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}
18
6
${ code}
You can’t perform that action at this time.
0 commit comments