File tree Expand file tree Collapse file tree 1 file changed +11
-10
lines changed Expand file tree Collapse file tree 1 file changed +11
-10
lines changed Original file line number Diff line number Diff line change @@ -92,9 +92,18 @@ fn main() {
9292 continue ;
9393 }
9494 }
95-
95+ let mut problem_stat: Option < StatWithStatus > = None ;
96+ for p in fetcher:: get_problems ( ) . unwrap ( ) . stat_status_pairs {
97+ if p. stat . frontend_question_id == id {
98+ problem_stat = Some ( p) ;
99+ }
100+ }
101+ if problem_stat. is_none ( ) {
102+ println ! ( "Problem {} does not exist" , id) ;
103+ continue ;
104+ }
96105 let problem =
97- fetcher:: get_problem ( & get_problem_stat_map ( fetcher :: get_problems ( ) . unwrap ( ) ) [ & id ] )
106+ fetcher:: get_problem ( & problem_stat . unwrap ( ) )
98107 . unwrap_or_else ( || {
99108 panic ! (
100109 "Error: failed to get problem #{} (The problem may be paid-only or may not be exist)." ,
@@ -325,14 +334,6 @@ async fn deal_problem(problem_stat: StatWithStatus) {
325334 ) ;
326335}
327336
328- pub fn get_problem_stat_map ( problems : Problems ) -> HashMap < u32 , StatWithStatus > {
329- let mut ret = HashMap :: new ( ) ;
330- for problem_stat in problems. stat_status_pairs {
331- ret. insert ( problem_stat. stat . frontend_question_id , problem_stat) ;
332- }
333- ret
334- }
335-
336337// extract common code
337338pub fn get_file_name ( problem : & Problem , prefix : & str ) -> String {
338339 format ! (
You can’t perform that action at this time.
0 commit comments