Skip to content

Commit 796e089

Browse files
Merge pull request #1393 from rust-lang/try-commit-date
Insert try commit date into DB
2 parents fc9dd35 + 33f7f47 commit 796e089

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

database/src/pool/postgres.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -760,11 +760,7 @@ where
760760
let (name, date, ty) = match artifact {
761761
ArtifactId::Commit(commit) => (
762762
commit.sha.to_string(),
763-
if commit.is_try() {
764-
None
765-
} else {
766-
Some(commit.date.0)
767-
},
763+
Some(commit.date.0),
768764
if commit.is_try() { "try" } else { "master" },
769765
),
770766
ArtifactId::Tag(a) => (a.clone(), None, "release"),

site/src/request_handlers/graph.rs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
use collector::Bound;
2+
use database::CommitType;
23
use std::collections::HashMap;
34
use std::sync::Arc;
45

@@ -140,9 +141,19 @@ async fn create_graphs(
140141
}))
141142
}
142143

144+
/// Returns artifact IDs for the given range.
145+
/// Inside of the range (not at the start/end), only master commits are kept.
143146
fn artifact_ids_for_range(ctxt: &SiteCtxt, start: Bound, end: Bound) -> Vec<ArtifactId> {
144147
let range = ctxt.data_range(start..=end);
145-
range.into_iter().map(|c| c.into()).collect()
148+
let count = range.len();
149+
range
150+
.into_iter()
151+
.enumerate()
152+
.filter(|(index, commit)| {
153+
*index == 0 || *index == count - 1 || matches!(commit.r#type, CommitType::Master)
154+
})
155+
.map(|c| c.1.into())
156+
.collect()
146157
}
147158

148159
/// Creates a summary "benchmark" that averages the results of all other

0 commit comments

Comments
 (0)