Skip to content

Commit 3509000

Browse files
committed
pluralize the number of posted comments
1 parent e04367f commit 3509000

File tree

3 files changed

+10
-5
lines changed

3 files changed

+10
-5
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,8 @@ pub struct UpdatesGoal {
9898
/// Markdown with update text (bullet list)
9999
pub comments: Vec<ExistingGithubComment>,
100100

101-
/// Comments.len but accessible to the template
102-
pub num_comments: usize,
101+
/// The "<details>" summary, a prettified version of comments.len().
102+
pub details_summary: String,
103103

104104
/// Progress towards the goal
105105
pub progress: Progress,

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,11 @@ async fn prepare_goals(
122122

123123
let why_this_goal = why_this_goal(&issue_id, issue)?;
124124

125+
let details_summary = match comments.len() {
126+
0 => String::from("No updates posted."),
127+
1 => String::from("1 update posted."),
128+
len => format!("{len} updates posted."),
129+
};
125130
result.push(UpdatesGoal {
126131
title: title.clone(),
127132
issue_number: issue.number,
@@ -131,7 +136,7 @@ async fn prepare_goals(
131136
has_help_wanted,
132137
help_wanted,
133138
is_closed: issue.state == GithubIssueState::Closed,
134-
num_comments: comments.len(),
139+
details_summary,
135140
comments,
136141
tldr,
137142
why_this_goal,

templates/goal_comments.hbs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{{#if comments}}
22

33
<details>
4-
<summary>{{num_comments}} update(s) posted.</summary>
4+
<summary>{{details_summary}}</summary>
55

66
<!-- this comment helps to convince the markdown parser to do the right thing -->
77

@@ -29,7 +29,7 @@
2929
<!-- this comment helps to convince the markdown parser to do the right thing -->
3030

3131
<details>
32-
<summary>No updates posted.</summary>
32+
<summary>{{details_summary}}</summary>
3333
</details>
3434

3535
{{/if}}

0 commit comments

Comments
 (0)