Skip to content

Commit ef3d99e

Browse files
committed
Replace monthly team reports with rolling ones
When doing the champion review (or even just seeing what's happening at a glance), it's more valuable to show a rolling report of everything that happened recently. "Recently" is currently set to three months. The monthly team reports have been removed.
1 parent 17e9a3e commit ef3d99e

File tree

1 file changed

+31
-43
lines changed

1 file changed

+31
-43
lines changed

crates/mdbook-goals/src/mdbook_preprocessor.rs

Lines changed: 31 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -612,7 +612,7 @@ impl<'c> GoalPreprocessorWithContext<'c> {
612612
let team_virtual_path = format!("{}/index.md", team_name_str);
613613
let team_path = Path::new(&team_virtual_path);
614614

615-
let team_content = format!("# {} Team Champion Reports\n\nThis section contains monthly champion reports for the {} team.", team_name_str, team_name_str);
615+
let team_content = format!("# {} Team Champion Reports\n\nThis section contains champion reports for the {} team.", team_name_str, team_name_str);
616616
let mut team_chapter = Chapter::new(
617617
&team_chapter_name,
618618
team_content,
@@ -628,36 +628,34 @@ impl<'c> GoalPreprocessorWithContext<'c> {
628628

629629
let mut team_parent_names = parent_names.clone();
630630
team_parent_names.push(team_chapter_name.clone());
631-
let mut team_sub_index = 1;
632-
633-
// Generate monthly reports for this team
634-
for (year, month, month_name) in months.iter().rev() {
635-
// Reverse to show newest first
636-
let champion_content =
637-
self.generate_champion_report_content(milestone, team_name_str, *year, *month)?;
638-
639-
let monthly_chapter_name = format!("{} {}", month_name, year);
640-
let monthly_virtual_path = format!("{}/{:04}-{:02}.md", team_name_str, year, month);
641-
let monthly_path = Path::new(&monthly_virtual_path);
642-
643-
let mut monthly_chapter = Chapter::new(
644-
&monthly_chapter_name,
645-
champion_content,
646-
monthly_path,
647-
team_parent_names.clone(),
648-
);
649-
650-
if let Some(mut number) = team_chapter.number.clone() {
651-
number.0.push(team_sub_index);
652-
monthly_chapter.number = Some(number);
653-
team_sub_index += 1;
654-
}
631+
let team_sub_index = 1;
632+
633+
// Generate the "recent updates" report for this team
634+
635+
// Reverse to show newest first
636+
let champion_content =
637+
self.generate_champion_report_content(milestone, team_name_str)?;
638+
639+
let report_name = format!("Recent updates");
640+
let report_virtual_path = format!("{team_name_str}/recent-updates.md");
641+
let report_path = Path::new(&report_virtual_path);
642+
643+
let mut report_chapter = Chapter::new(
644+
&report_name,
645+
champion_content,
646+
report_path,
647+
team_parent_names.clone(),
648+
);
655649

656-
team_chapter
657-
.sub_items
658-
.push(BookItem::Chapter(monthly_chapter));
650+
if let Some(mut number) = team_chapter.number.clone() {
651+
number.0.push(team_sub_index);
652+
report_chapter.number = Some(number);
659653
}
660654

655+
team_chapter
656+
.sub_items
657+
.push(BookItem::Chapter(report_chapter));
658+
661659
parent_chapter
662660
.sub_items
663661
.push(BookItem::Chapter(team_chapter));
@@ -716,26 +714,16 @@ impl<'c> GoalPreprocessorWithContext<'c> {
716714
&mut self,
717715
milestone: &str,
718716
team_name: &str,
719-
year: i32,
720-
month: u32,
721717
) -> anyhow::Result<String> {
722-
use chrono::NaiveDate;
718+
// Look at the updates for the last ~three months
719+
let end_date = chrono::Utc::now().date_naive();
720+
let start_date = end_date - chrono::TimeDelta::days(90);
723721

724722
eprintln!(
725-
"👥 Generating champion report for {} team, {}-{:02} (milestone: {})",
726-
team_name, year, month, milestone
723+
"👥 Generating champion report for {} team, {start_date} - {end_date} (milestone: {})",
724+
team_name, milestone
727725
);
728726

729-
// Calculate start and end dates for the month
730-
let start_date = NaiveDate::from_ymd_opt(year, month, 1)
731-
.ok_or_else(|| anyhow::anyhow!("Invalid date: {}-{:02}-01", year, month))?;
732-
let end_date = if month == 12 {
733-
NaiveDate::from_ymd_opt(year + 1, 1, 1)
734-
} else {
735-
NaiveDate::from_ymd_opt(year, month + 1, 1)
736-
}
737-
.ok_or_else(|| anyhow::anyhow!("Invalid end date calculation for {}-{:02}", year, month))?;
738-
739727
// Get repository from context - assuming rust-lang/rust-project-goals as default
740728
let repository =
741729
rust_project_goals::gh::issue_id::Repository::new("rust-lang", "rust-project-goals");

0 commit comments

Comments
 (0)