mirror of
https://github.com/google/comprehensive-rust.git
synced 2025-06-09 19:07:30 +02:00
Adjust morning-session timings downward (#1786)
Based on feedback from @marshallpierce that mornings took about 2.5 hours, this adjusts a bunch of the morning times downward to try to match that. In other words, this is trying to make the times in the course more accurate, rather than reducing the amount of time available for these slides. This also updates the `course-schedule` tool to be able to show per-segment timings.
This commit is contained in:
parent
e921d4bb1e
commit
9f67c9b0e7
@ -12,21 +12,29 @@
|
|||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
|
use clap::Command;
|
||||||
use mdbook::MDBook;
|
use mdbook::MDBook;
|
||||||
use mdbook_course::course::{Course, Courses};
|
use mdbook_course::course::Courses;
|
||||||
use mdbook_course::markdown::duration;
|
use mdbook_course::markdown::duration;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
pretty_env_logger::init();
|
pretty_env_logger::init();
|
||||||
|
let app = Command::new("mdbook-course")
|
||||||
|
.about("mdbook preprocessor for Comprehensive Rust")
|
||||||
|
.subcommand(Command::new("sessions").about("Show session summary (default)"))
|
||||||
|
.subcommand(Command::new("segments").about("Show segment summary"))
|
||||||
|
.subcommand(Command::new("pr").about("Show summary for a PR"));
|
||||||
|
let matches = app.get_matches();
|
||||||
|
|
||||||
let root_dir = ".";
|
let root_dir = ".";
|
||||||
let mdbook = MDBook::load(root_dir).expect("Unable to load the book");
|
let mdbook = MDBook::load(root_dir).expect("Unable to load the book");
|
||||||
let (courses, _) = Courses::extract_structure(mdbook.book)
|
let (courses, _) = Courses::extract_structure(mdbook.book)
|
||||||
.expect("Unable to extract course structure");
|
.expect("Unable to extract course structure");
|
||||||
|
|
||||||
println!("## Course Schedule");
|
match matches.subcommand() {
|
||||||
println!("With this pull request applied, the course schedule is as follows:");
|
Some(("session", _)) | None => session_summary(&courses),
|
||||||
for course in &courses {
|
Some(("pr", _)) => pr_summary(&courses),
|
||||||
print_summary(course);
|
_ => unreachable!(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -44,18 +52,42 @@ fn timediff(actual: u64, target: u64, slop: u64) -> String {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn print_summary(course: &Course) {
|
fn session_summary(courses: &Courses) {
|
||||||
if course.target_minutes() == 0 {
|
for course in courses {
|
||||||
return;
|
if course.target_minutes() == 0 {
|
||||||
}
|
return;
|
||||||
println!("### {}", course.name);
|
}
|
||||||
println!("_{}_", timediff(course.minutes(), course.target_minutes(), 15));
|
for session in course {
|
||||||
|
println!("### {} // {}", course.name, session.name);
|
||||||
for session in course {
|
println!(
|
||||||
println!(
|
"_{}_",
|
||||||
"* {} - _{}_",
|
timediff(session.minutes(), session.target_minutes(), 15)
|
||||||
session.name,
|
);
|
||||||
timediff(session.minutes(), session.target_minutes(), 5)
|
println!();
|
||||||
);
|
for segment in session {
|
||||||
|
println!("* {} - _{}_", segment.name, duration(segment.minutes()));
|
||||||
|
}
|
||||||
|
println!();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn pr_summary(courses: &Courses) {
|
||||||
|
println!("## Course Schedule");
|
||||||
|
println!("With this pull request applied, the course schedule is as follows:");
|
||||||
|
for course in courses {
|
||||||
|
if course.target_minutes() == 0 {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
println!("### {}", course.name);
|
||||||
|
println!("_{}_", timediff(course.minutes(), course.target_minutes(), 15));
|
||||||
|
|
||||||
|
for session in course {
|
||||||
|
println!(
|
||||||
|
"* {} - _{}_",
|
||||||
|
session.name,
|
||||||
|
timediff(session.minutes(), session.target_minutes(), 5)
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
minutes: 10
|
minutes: 5
|
||||||
---
|
---
|
||||||
|
|
||||||
# Blocks and Scopes
|
# Blocks and Scopes
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
minutes: 5
|
minutes: 4
|
||||||
---
|
---
|
||||||
|
|
||||||
# `break` and `continue`
|
# `break` and `continue`
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
minutes: 5
|
minutes: 4
|
||||||
---
|
---
|
||||||
|
|
||||||
# Conditionals
|
# Conditionals
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
minutes: 15
|
minutes: 10
|
||||||
---
|
---
|
||||||
|
|
||||||
# Generic Data Types
|
# Generic Data Types
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
minutes: 10
|
minutes: 8
|
||||||
---
|
---
|
||||||
|
|
||||||
# Trait Bounds
|
# Trait Bounds
|
||||||
|
@ -2,10 +2,6 @@
|
|||||||
minutes: 5
|
minutes: 5
|
||||||
---
|
---
|
||||||
|
|
||||||
<!-- NOTES:
|
|
||||||
The Iterator trait and basic usage
|
|
||||||
-->
|
|
||||||
|
|
||||||
# `Iterator`
|
# `Iterator`
|
||||||
|
|
||||||
The [`Iterator`][1] trait supports iterating over values in a collection. It
|
The [`Iterator`][1] trait supports iterating over values in a collection. It
|
||||||
|
@ -2,10 +2,6 @@
|
|||||||
minutes: 5
|
minutes: 5
|
||||||
---
|
---
|
||||||
|
|
||||||
<!-- NOTES:
|
|
||||||
Present Copy as added functionality on top of the default move semantics: with Copy, the old value does not become invalid; Can derive Copy for a type if it implements Clone
|
|
||||||
-->
|
|
||||||
|
|
||||||
# Copy Types
|
# Copy Types
|
||||||
|
|
||||||
While move semantics are the default, certain types are copied by default:
|
While move semantics are the default, certain types are copied by default:
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
minutes: 10
|
minutes: 8
|
||||||
---
|
---
|
||||||
|
|
||||||
# The `Drop` Trait
|
# The `Drop` Trait
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
minutes: 10
|
minutes: 5
|
||||||
---
|
---
|
||||||
|
|
||||||
# Move Semantics
|
# Move Semantics
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
minutes: 5
|
minutes: 3
|
||||||
---
|
---
|
||||||
|
|
||||||
# Deriving
|
# Deriving
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
minutes: 10
|
minutes: 8
|
||||||
---
|
---
|
||||||
|
|
||||||
# Methods
|
# Methods
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
minutes: 10
|
minutes: 8
|
||||||
---
|
---
|
||||||
|
|
||||||
# Traits
|
# Traits
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
minutes: 5
|
minutes: 3
|
||||||
---
|
---
|
||||||
|
|
||||||
# Modules
|
# Modules
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
minutes: 10
|
minutes: 8
|
||||||
---
|
---
|
||||||
|
|
||||||
# use, super, self
|
# use, super, self
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
minutes: 10
|
minutes: 8
|
||||||
---
|
---
|
||||||
|
|
||||||
# Destructuring
|
# Destructuring
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
minutes: 10
|
minutes: 8
|
||||||
---
|
---
|
||||||
|
|
||||||
# `Box<T>`
|
# `Box<T>`
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
minutes: 5
|
minutes: 3
|
||||||
---
|
---
|
||||||
|
|
||||||
# Compiler Lints and Clippy
|
# Compiler Lints and Clippy
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
minutes: 10
|
minutes: 5
|
||||||
---
|
---
|
||||||
|
|
||||||
# Other Types of Tests
|
# Other Types of Tests
|
||||||
|
@ -23,7 +23,7 @@ fn first_word(text: &str) -> &str {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod test {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
minutes: 5
|
minutes: 3
|
||||||
---
|
---
|
||||||
|
|
||||||
# Arithmetic
|
# Arithmetic
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
minutes: 5
|
minutes: 3
|
||||||
---
|
---
|
||||||
|
|
||||||
# Type Inference
|
# Type Inference
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
minutes: 10
|
minutes: 5
|
||||||
---
|
---
|
||||||
|
|
||||||
# Strings
|
# Strings
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
minutes: 10
|
minutes: 5
|
||||||
---
|
---
|
||||||
|
|
||||||
# Values
|
# Values
|
||||||
|
Loading…
x
Reference in New Issue
Block a user