Skip to content

Only display master commits in bootstrap chart #1407

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions database/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,9 @@ impl Commit {
pub fn is_try(&self) -> bool {
matches!(self.r#type, CommitType::Try)
}
pub fn is_master(&self) -> bool {
matches!(self.r#type, CommitType::Master)
}
}

impl hash::Hash for Commit {
Expand Down
6 changes: 5 additions & 1 deletion site/src/request_handlers/bootstrap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@ pub async fn handle_bootstrap(
) -> ServerResult<bootstrap::Response> {
log::info!("handle_bootstrap({:?})", body);
let range = ctxt.data_range(body.start.clone()..=body.end.clone());
let commits: Vec<ArtifactId> = range.iter().map(|c| c.clone().into()).collect();
let commits: Vec<ArtifactId> = range
.into_iter()
.filter(|c| c.is_master())
.map(|c| c.into())
.collect();

let conn = ctxt.conn().await;
let ids = commits
Expand Down
5 changes: 1 addition & 4 deletions site/src/request_handlers/graph.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use collector::Bound;
use database::CommitType;
use std::collections::HashMap;
use std::sync::Arc;

Expand Down Expand Up @@ -149,9 +148,7 @@ fn artifact_ids_for_range(ctxt: &SiteCtxt, start: Bound, end: Bound) -> Vec<Arti
range
.into_iter()
.enumerate()
.filter(|(index, commit)| {
*index == 0 || *index == count - 1 || matches!(commit.r#type, CommitType::Master)
})
.filter(|(index, commit)| *index == 0 || *index == count - 1 || commit.is_master())
.map(|c| c.1.into())
.collect()
}
Expand Down