Skip to content

Commit

Permalink
min_left
Browse files Browse the repository at this point in the history
  • Loading branch information
epompeii committed Sep 30, 2023
1 parent 93c95ac commit cb7bfbb
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 12 deletions.
2 changes: 2 additions & 0 deletions services/api/src/endpoints/project/perf/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -332,10 +332,12 @@ fn perf_query(
.filter(schema::branch_version::branch_id.eq(branch_id))
.filter(schema::report::testbed_id.eq(testbed_id))
.filter(schema::perf::benchmark_id.eq(benchmark_id))
// There may or may not be a boundary for any given metric
.left_join(
schema::boundary::table
.inner_join(schema::threshold::table)
.inner_join(schema::statistic::table)
// There may or may not be an alert for any given boundary
.left_join(schema::alert::table),
)
.into_boxed();
Expand Down
1 change: 1 addition & 0 deletions services/api/src/model/project/benchmark.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ impl QueryBenchmark {
let (query_benchmark, query_metric, query_boundary) = schema::metric::table
.filter(schema::metric::id.eq(metric_id))
.inner_join(schema::perf::table.inner_join(schema::benchmark::table))
// There may or may not be a boundary for any given metric
.left_join(schema::boundary::table)
.select((
(
Expand Down
4 changes: 2 additions & 2 deletions services/api/src/model/project/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ impl QueryProject {
id: ProjectId,
) -> Result<Option<SubscriptionId>, ApiError> {
let subscription: Option<String> = schema::organization::table
.left_join(schema::project::table)
.inner_join(schema::project::table)
.filter(schema::project::id.eq(id))
.select(schema::organization::subscription)
.first(conn)
Expand All @@ -181,7 +181,7 @@ impl QueryProject {
id: ProjectId,
) -> Result<Option<(Uuid, Jwt)>, ApiError> {
let (uuid, license): (String, Option<String>) = schema::organization::table
.left_join(schema::project::table)
.inner_join(schema::project::table)
.filter(schema::project::id.eq(id))
.select((schema::organization::uuid, schema::organization::license))
.first(conn)
Expand Down
1 change: 1 addition & 0 deletions services/api/src/model/project/report/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ fn get_report_results(
.inner_join(schema::benchmark::table)
.inner_join(schema::metric::table
.inner_join(schema::metric_kind::table)
// There may or may not be a boundary for any given metric
.left_join(schema::boundary::table
.inner_join(schema::threshold::table)
.inner_join(schema::statistic::table)
Expand Down
10 changes: 5 additions & 5 deletions services/api/src/model/project/report/results/detector/data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@ impl MetricsData {
.filter(schema::metric::metric_kind_id.eq(metric_kind_id))
.inner_join(
schema::perf::table
.left_join(
.inner_join(
schema::report::table
.left_join(schema::version::table.left_join(
schema::branch_version::table.left_join(schema::branch::table),
.inner_join(schema::version::table.inner_join(
schema::branch_version::table.inner_join(schema::branch::table),
))
.left_join(schema::testbed::table),
.inner_join(schema::testbed::table),
)
.left_join(schema::benchmark::table),
.inner_join(schema::benchmark::table),
)
.filter(schema::branch::id.eq(branch_id))
.filter(schema::testbed::id.eq(testbed_id))
Expand Down
6 changes: 3 additions & 3 deletions services/api/src/model/project/threshold/alert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@ impl QueryAlert {
) -> Result<Self, ApiError> {
schema::alert::table
.filter(schema::alert::uuid.eq(uuid.to_string()))
.left_join(
schema::boundary::table.left_join(
.inner_join(
schema::boundary::table.inner_join(
schema::metric::table
.left_join(schema::perf::table.left_join(schema::benchmark::table)),
.inner_join(schema::perf::table.inner_join(schema::benchmark::table)),
),
)
.filter(schema::benchmark::project_id.eq(project_id))
Expand Down
4 changes: 2 additions & 2 deletions services/api/src/model/project/version.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ impl QueryVersion {
) -> Result<VersionId, HttpError> {
if let Some(hash) = hash {
if let Ok(version_id) = schema::version::table
.left_join(schema::branch_version::table)
.inner_join(schema::branch_version::table)
.filter(schema::branch_version::branch_id.eq(branch_id))
.filter(schema::version::hash.eq(hash.as_ref()))
.order(schema::version::number.desc())
Expand Down Expand Up @@ -86,7 +86,7 @@ impl InsertVersion {
// Get the most recent code version number for this branch and increment it.
// Otherwise, start a new branch code version number count from zero.
let number = if let Ok(number) = schema::version::table
.left_join(schema::branch_version::table)
.inner_join(schema::branch_version::table)
.filter(schema::branch_version::branch_id.eq(branch_id))
.select(schema::version::number)
.order(schema::version::number.desc())
Expand Down

0 comments on commit cb7bfbb

Please sign in to comment.