1
0
mirror of https://github.com/google/comprehensive-rust.git synced 2025-05-29 21:57:42 +02:00

Handle a missing "Fundamentals" course (#1509)

We need to work with translations which haven't yet been updated to use
frontmatter.
This commit is contained in:
Martin Geisler 2023-11-29 17:11:22 +01:00 committed by GitHub
parent 6d19292f16
commit 3997a7d874
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -87,21 +87,24 @@ fn preprocess() -> anyhow::Result<()> {
}
};
// Print a summary of times for the "Fundamentals" course.
let fundamentals = courses.find_course("Fundamentals").unwrap();
eprintln!(
"Fundamentals: {}",
timediff(fundamentals.minutes(), 8 * 3 * 60)
);
eprintln!("Sessions:");
for session in fundamentals {
// Translations with a POT-Creation-Date before 2023-11-29 (when
// we merged #1073) will have no frontmatter.
if let Some(fundamentals) = courses.find_course("Fundamentals") {
eprintln!(
" {}: {}",
session.name,
timediff(session.minutes(), 3 * 60)
"Fundamentals: {}",
timediff(fundamentals.minutes(), 8 * 3 * 60)
);
for segment in session {
eprintln!(" {}: {}", segment.name, duration(segment.minutes()));
eprintln!("Sessions:");
for session in fundamentals {
eprintln!(
" {}: {}",
session.name,
timediff(session.minutes(), 3 * 60)
);
for segment in session {
eprintln!(" {}: {}", segment.name, duration(segment.minutes()));
}
}
}