File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed
Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -215,11 +215,22 @@ impl TmcCore {
215215 /// ]);
216216 /// ```
217217 pub fn download_or_update_exercises ( & self , exercises : Vec < ( usize , & Path ) > ) -> Result < ( ) > {
218+ let step = 1.0 / ( 2 * exercises. len ( ) ) as f64 ;
219+
220+ let mut progress = 0.0 ;
218221 for ( exercise_id, target) in exercises {
222+ // TODO: do in memory without zip_file?
219223 let zip_file = NamedTempFile :: new ( ) . map_err ( CoreError :: TempFile ) ?;
224+
225+ self . report_progress ( "Downloading exercise..." , progress) ;
220226 self . download_exercise ( exercise_id, zip_file. path ( ) ) ?;
227+ progress += step;
228+
229+ self . report_progress ( "Extracting exercise..." , progress) ;
221230 task_executor:: extract_project ( zip_file. path ( ) , target) ?;
231+ progress += step;
222232 }
233+ self . report_complete ( "Finished downloading and extracting exercises." ) ;
223234 Ok ( ( ) )
224235 }
225236
You can’t perform that action at this time.
0 commit comments