Skip to content

Commit 2b29cf5

Browse files
committed
compute goal counts dynamically instead of hardcoding
1 parent 9ab71e9 commit 2b29cf5

File tree

3 files changed

+19
-6
lines changed

3 files changed

+19
-6
lines changed

crates/rust-project-goals-cli-llm/src/templates.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,24 @@ pub struct Updates {
4646
pub milestone: String,
4747
pub flagship_goals: Vec<UpdatesGoal>,
4848
pub other_goals: Vec<UpdatesGoal>,
49+
pub goal_count: usize,
50+
pub flagship_goal_count: usize,
4951
}
5052

5153
impl Updates {
54+
pub fn new(
55+
milestone: String,
56+
flagship_goals: Vec<UpdatesGoal>,
57+
other_goals: Vec<UpdatesGoal>,
58+
) -> Self {
59+
Updates {
60+
milestone,
61+
flagship_goal_count: flagship_goals.len(),
62+
goal_count: flagship_goals.len() + other_goals.len(),
63+
flagship_goals,
64+
other_goals,
65+
}
66+
}
5267
pub fn render(self) -> anyhow::Result<String> {
5368
let templates = Templates::new()?;
5469
Ok(templates.reg.render("updates", &self)?)

crates/rust-project-goals-cli-llm/src/updates.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,9 @@ pub async fn updates(
4444
progress_bar::Style::Bold,
4545
);
4646

47-
let updates = templates::Updates {
48-
milestone: milestone.to_string(),
49-
flagship_goals: prepare_goals(repository, &issues, &filter, true).await?,
50-
other_goals: prepare_goals(repository, &issues, &filter, false).await?,
51-
};
47+
let flagship_goals = prepare_goals(repository, &issues, &filter, true).await?;
48+
let other_goals = prepare_goals(repository, &issues, &filter, false).await?;
49+
let updates = templates::Updates::new(milestone.to_string(), flagship_goals, other_goals);
5250

5351
progress_bar::finalize_progress_bar();
5452

templates/updates.hbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
The Rust project is currently working towards a [slate of 26 project goals](https://rust-lang.github.io/rust-project-goals/{{milestone}}/goals.html), with 3 of them designed as [Flagship Goals](https://rust-lang.github.io/rust-project-goals/{{milestone}}/goals.html#flagship-goals). This post provides selected updates on our progress towards these goals (or, in some cases, lack thereof). The full details for any particular goal are available in its associated [tracking issue on the rust-project-goals repository](https://github.com/rust-lang/rust-project-goals/issues?q=is%3Aissue%20state%3Aopen%20label%3AC-tracking-issue).
1+
The Rust project is currently working towards a [slate of {{goal_count}} project goals](https://rust-lang.github.io/rust-project-goals/{{milestone}}/goals.html), with {{flagship_goal_count}} of them designed as [Flagship Goals](https://rust-lang.github.io/rust-project-goals/{{milestone}}/goals.html#flagship-goals). This post provides selected updates on our progress towards these goals (or, in some cases, lack thereof). The full details for any particular goal are available in its associated [tracking issue on the rust-project-goals repository](https://github.com/rust-lang/rust-project-goals/issues?q=is%3Aissue%20state%3Aopen%20label%3AC-tracking-issue).
22

33
## Flagship goals
44

0 commit comments

Comments
 (0)