File tree 1 file changed +4
-11
lines changed
1 file changed +4
-11
lines changed Original file line number Diff line number Diff line change @@ -139,8 +139,8 @@ impl Command for PickCommand {
139
139
//check for name specified
140
140
true => {
141
141
match m. get_one :: < String > ( "name" ) . map ( |name| name) {
142
- Some ( quesname) => match cache. get_problem_from_name ( quesname) {
143
- Ok ( p) => p. fid ,
142
+ Some ( quesname) => match cache. get_problem_id_from_name ( quesname) {
143
+ Ok ( p) => p,
144
144
Err ( _) => 1 ,
145
145
} ,
146
146
None => {
@@ -158,18 +158,11 @@ impl Command for PickCommand {
158
158
// Pick random without specify id
159
159
let problem = & problems[ rand:: thread_rng ( ) . gen_range ( 0 ..problems. len ( ) ) ] ;
160
160
problem. fid
161
- } ) ;
162
-
163
- let id = match fid {
164
- Ok ( id) => id,
165
- Err ( _) => {
166
- // Pick random without specify id
167
- let problem = & problems[ rand:: thread_rng ( ) . gen_range ( 0 ..problems. len ( ) ) ] ;
168
- problem. fid
161
+ } )
169
162
}
170
163
} ;
171
164
172
- let r = cache. get_question ( id ) . await ;
165
+ let r = cache. get_question ( fid ) . await ;
173
166
174
167
match r {
175
168
Ok ( q) => println ! ( "{}" , q. desc( ) ) ,
You can’t perform that action at this time.
0 commit comments