File tree Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -48,6 +48,9 @@ cmd.handler = function(argv) {
4848 console . log ( util . format (
4949 ' ✔ expected: %s' , result . expected_output ) ) ;
5050 }
51+
52+ // update this problem status in local cache
53+ core . updateProblem ( problem , { state : ( ok ? 'ac' : 'notac' ) } ) ;
5154 } ) ;
5255 } ) ;
5356} ;
Original file line number Diff line number Diff line change @@ -45,6 +45,19 @@ core.submitProblem = function(problem, cb) {
4545 client . submitProblem ( problem , cb ) ;
4646} ;
4747
48+ core . updateProblem = function ( problem , kv ) {
49+ var problems = cache . get ( 'all' ) ;
50+ if ( ! problems ) return false ;
51+
52+ var old_problem = _ . find ( problems , function ( x ) {
53+ return x . id === problem . id ;
54+ } ) ;
55+ if ( ! old_problem ) return false ;
56+
57+ _ . extend ( old_problem , kv ) ;
58+ return cache . set ( 'all' , problems ) ;
59+ } ;
60+
4861core . login = function ( user , cb ) {
4962 client . login ( user , function ( e , user ) {
5063 if ( e ) return cb ( e ) ;
You can’t perform that action at this time.
0 commit comments