File tree 2 files changed +7
-5
lines changed
2 files changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -49,12 +49,12 @@ fn main() {
49
49
. next ( ) ;
50
50
if code. is_none ( ) {
51
51
println ! ( "Problem {} has no rust version." , & id) ;
52
- solved_ids. push ( id ) ;
52
+ solved_ids. push ( problem . question_id ) ;
53
53
continue ;
54
54
}
55
55
let code = code. unwrap ( ) ;
56
56
57
- let file_name = format ! ( "n{:04}_{}" , id , problem. title_slug. replace( "-" , "_" ) ) ;
57
+ let file_name = format ! ( "n{:04}_{}" , problem . question_id , problem. title_slug. replace( "-" , "_" ) ) ;
58
58
let file_path = Path :: new ( "./src" ) . join ( format ! ( "{}.rs" , file_name) ) ;
59
59
if file_path. exists ( ) {
60
60
panic ! ( "problem already initialized" ) ;
@@ -65,7 +65,7 @@ fn main() {
65
65
. replace ( "__PROBLEM_TITLE__" , & problem. title )
66
66
. replace ( "__PROBLEM_DESC__" , & build_desc ( & problem. content ) )
67
67
. replace ( "__PROBLEM_DEFAULT_CODE__" , & code. default_code )
68
- . replace ( "__PROBLEM_ID__" , & format ! ( "{}" , id ) )
68
+ . replace ( "__PROBLEM_ID__" , & format ! ( "{}" , problem . question_id ) )
69
69
. replace ( "__EXTRA_USE__" , & parse_extra_use ( & code. default_code ) ) ;
70
70
71
71
let mut file = fs:: OpenOptions :: new ( )
Original file line number Diff line number Diff line change @@ -17,10 +17,10 @@ query questionData($titleSlug: String!) {
17
17
}"# ;
18
18
const QUESTION_QUERY_OPERATION : & str = "questionData" ;
19
19
20
- pub fn get_problem ( id : u32 ) -> Option < Problem > {
20
+ pub fn get_problem ( frontend_question_id : u32 ) -> Option < Problem > {
21
21
let problems = get_problems ( ) . unwrap ( ) ;
22
22
for problem in problems. stat_status_pairs . iter ( ) {
23
- if problem. stat . question_id == id {
23
+ if problem. stat . frontend_question_id == frontend_question_id {
24
24
25
25
if problem. paid_only {
26
26
return None
@@ -38,6 +38,7 @@ pub fn get_problem(id: u32) -> Option<Problem> {
38
38
content : resp. data . question . content ,
39
39
sample_test_case : resp. data . question . sample_test_case ,
40
40
difficulty : problem. difficulty . to_string ( ) ,
41
+ question_id : problem. stat . question_id ,
41
42
} )
42
43
}
43
44
}
@@ -58,6 +59,7 @@ pub struct Problem {
58
59
#[ serde( rename = "sampleTestCase" ) ]
59
60
pub sample_test_case : String ,
60
61
pub difficulty : String ,
62
+ pub question_id : u32 ,
61
63
}
62
64
63
65
#[ derive( Serialize , Deserialize ) ]
You can’t perform that action at this time.
0 commit comments