Skip to content

Commit 864026f

Browse files
authored
Merge pull request #106 from rage/fixes
capitalized refresh stage text, set progress reporting back to a 0.0-…
2 parents 2b53885 + c5ec301 commit 864026f

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

tmc-langs-util/src/progress_reporter.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ pub fn start_stage<T: 'static + Send + Sync>(total_steps: usize, message: String
5656
let status_update = StatusUpdate {
5757
finished: false,
5858
message,
59-
percent_done: reporter.current_progress * 100.0,
59+
percent_done: reporter.current_progress,
6060
time: reporter.start_time.elapsed().as_millis(),
6161
data,
6262
};
@@ -92,7 +92,7 @@ pub fn progress_stage<T: 'static + Send + Sync>(message: String, data: Option<T>
9292
let status_update = StatusUpdate {
9393
finished: false,
9494
message,
95-
percent_done: reporter.current_progress * 100.0,
95+
percent_done: reporter.current_progress,
9696
time: reporter.start_time.elapsed().as_millis(),
9797
data,
9898
};
@@ -123,7 +123,7 @@ pub fn finish_stage<T: 'static + Send + Sync>(message: String, data: Option<T>)
123123
let status_update = StatusUpdate {
124124
finished: true,
125125
message,
126-
percent_done: reporter.current_progress * 100.0,
126+
percent_done: reporter.current_progress,
127127
time: reporter.start_time.elapsed().as_millis(),
128128
data,
129129
};
@@ -196,9 +196,9 @@ mod test {
196196
start_stage::<usize>(2, "starting".to_string(), None);
197197

198198
progress_stage::<usize>("hello".to_string(), None);
199-
assert!((su.lock().unwrap().as_ref().unwrap().percent_done - 50.0).abs() < 0.01);
199+
assert!((su.lock().unwrap().as_ref().unwrap().percent_done - 0.5000).abs() < 0.01);
200200
progress_stage::<usize>("hello!".to_string(), Some(2));
201-
assert!((su.lock().unwrap().as_ref().unwrap().percent_done - 100.0).abs() < 0.01);
201+
assert!((su.lock().unwrap().as_ref().unwrap().percent_done - 1.0000).abs() < 0.01);
202202
}
203203

204204
#[test]
@@ -215,24 +215,24 @@ mod test {
215215

216216
start_stage::<usize>(2, "starting".to_string(), None);
217217
progress_stage::<usize>("msg".to_string(), None);
218-
assert!((su.lock().unwrap().as_ref().unwrap().percent_done - 50.0).abs() < 0.01);
218+
assert!((su.lock().unwrap().as_ref().unwrap().percent_done - 0.5000).abs() < 0.01);
219219

220220
start_stage::<usize>(2, "starting".to_string(), None);
221221
progress_stage::<usize>("msg".to_string(), None);
222-
assert!((su.lock().unwrap().as_ref().unwrap().percent_done - 66.6666).abs() < 0.01);
222+
assert!((su.lock().unwrap().as_ref().unwrap().percent_done - 0.6666).abs() < 0.01);
223223

224224
start_stage::<usize>(2, "starting".to_string(), None);
225225
progress_stage::<usize>("msg".to_string(), None);
226-
assert!((su.lock().unwrap().as_ref().unwrap().percent_done - 74.9992).abs() < 0.01);
226+
assert!((su.lock().unwrap().as_ref().unwrap().percent_done - 0.7499).abs() < 0.01);
227227
progress_stage::<usize>("msg".to_string(), None);
228-
assert!((su.lock().unwrap().as_ref().unwrap().percent_done - 83.3317).abs() < 0.01);
228+
assert!((su.lock().unwrap().as_ref().unwrap().percent_done - 0.8333).abs() < 0.01);
229229
finish_stage::<usize>("msg".to_string(), None);
230-
assert!((su.lock().unwrap().as_ref().unwrap().percent_done - 83.3317).abs() < 0.01);
230+
assert!((su.lock().unwrap().as_ref().unwrap().percent_done - 0.8333).abs() < 0.01);
231231

232232
finish_stage::<usize>("msg".to_string(), None);
233-
assert!((su.lock().unwrap().as_ref().unwrap().percent_done - 91.6642).abs() < 0.01);
233+
assert!((su.lock().unwrap().as_ref().unwrap().percent_done - 0.9166).abs() < 0.01);
234234

235235
finish_stage::<usize>("msg".to_string(), None);
236-
assert!((su.lock().unwrap().as_ref().unwrap().percent_done - 100.0).abs() < 0.01);
236+
assert!((su.lock().unwrap().as_ref().unwrap().percent_done - 1.0000).abs() < 0.01);
237237
}
238238
}

tmc-langs-util/src/task_executor/course_refresher.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ pub fn refresh_course(
3939
cache_root: PathBuf,
4040
) -> Result<RefreshData, UtilError> {
4141
log::info!("refreshing course {}", course_name);
42-
start_stage(9, "refreshing course");
42+
start_stage(9, "Refreshing course");
4343

4444
// create new cache path
4545
let old_version = course_cache_path

0 commit comments

Comments
 (0)