1
0
mirror of https://github.com/google/comprehensive-rust.git synced 2025-11-06 09:29:26 +02:00

Add course and session markers for deep-dives (#1521)

This doesn't add any timing information. The authors of each deep-dive
can do that separately.

Fixes #1510.
This commit is contained in:
Dustin J. Mitchell
2023-11-30 09:26:21 -05:00
committed by GitHub
parent 8862ab6530
commit a73c830e45
8 changed files with 26 additions and 1 deletions

View File

@@ -321,6 +321,9 @@ impl Session {
/// Return the total duration of this session.
pub fn minutes(&self) -> u64 {
let instructional_time: u64 = self.into_iter().map(|s| s.minutes()).sum();
if instructional_time == 0 {
return instructional_time;
}
let breaks = (self.into_iter().filter(|s| s.minutes() > 0).count() - 1) as u64
* BREAK_DURATION;
instructional_time + breaks