Skip to content

Commit d108ce6

Browse files
committed
Rename "graph data" things to "graph point" things
1 parent 5605158 commit d108ce6

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

site/src/request_handlers/graph.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ pub async fn handle_graph(
5050
};
5151

5252
for (idx, point) in points.iter().enumerate() {
53-
series.points.push(point.y);
53+
series.points.push(point.value);
5454
if point.is_interpolated {
5555
series.is_interpolated.insert(idx as u16);
5656
}
@@ -83,15 +83,15 @@ pub async fn handle_graph(
8383
Ok(resp)
8484
}
8585

86-
struct GraphData {
87-
y: f32,
86+
struct GraphPoint {
87+
value: f32,
8888
is_interpolated: bool,
8989
}
9090

9191
async fn handle_graph_impl(
9292
body: graph::Request,
9393
ctxt: &SiteCtxt,
94-
) -> ServerResult<HashMap<String, HashMap<String, Vec<(String, Vec<GraphData>)>>>> {
94+
) -> ServerResult<HashMap<String, HashMap<String, Vec<(String, Vec<GraphPoint>)>>>> {
9595
let range = ctxt.data_range(body.start.clone()..=body.end.clone());
9696
let commits: Arc<Vec<_>> = Arc::new(range.iter().map(|c| c.clone().into()).collect());
9797

@@ -112,7 +112,7 @@ async fn handle_graph_impl(
112112
.into_iter()
113113
.map(|sr| {
114114
sr.interpolate()
115-
.map(|series| to_graph_data(body.kind, series).collect::<Vec<_>>())
115+
.map(|series| to_graph_points(body.kind, series).collect::<Vec<_>>())
116116
})
117117
.collect::<Vec<_>>();
118118

@@ -182,7 +182,7 @@ async fn handle_graph_impl(
182182
.collect(),
183183
)
184184
.map(|((c, d), i)| ((c, Some(d.expect("interpolated") / against)), i));
185-
let graph_data = to_graph_data(body.kind, averaged).collect::<Vec<_>>();
185+
let graph_data = to_graph_points(body.kind, averaged).collect::<Vec<_>>();
186186
series.push(selector::SeriesResponse {
187187
path: selector::Path::new()
188188
.set(PathComponent::Benchmark("Summary".into()))
@@ -215,10 +215,10 @@ async fn handle_graph_impl(
215215
Ok(by_test_case)
216216
}
217217

218-
fn to_graph_data<'a>(
218+
fn to_graph_points<'a>(
219219
kind: GraphKind,
220220
points: impl Iterator<Item = ((ArtifactId, Option<f64>), Interpolated)> + 'a,
221-
) -> impl Iterator<Item = GraphData> + 'a {
221+
) -> impl Iterator<Item = GraphPoint> + 'a {
222222
let mut first = None;
223223
let mut prev = None;
224224
points.map(move |((_aid, point), interpolated)| {
@@ -229,8 +229,8 @@ fn to_graph_data<'a>(
229229
let previous_point = prev.unwrap_or(point);
230230
let percent_prev = (point - previous_point) / previous_point * 100.0;
231231
prev = Some(point);
232-
GraphData {
233-
y: match kind {
232+
GraphPoint {
233+
value: match kind {
234234
GraphKind::Raw => point as f32,
235235
GraphKind::PercentRelative => percent_prev as f32,
236236
GraphKind::PercentFromFirst => percent_first as f32,

0 commit comments

Comments
 (0)