Skip to content

Commit

Permalink
fix: disregarding experiments last-modified filter in case of (#295)
Browse files Browse the repository at this point in the history
  • Loading branch information
ShubhranshuSanjeev authored Dec 3, 2024
1 parent 849063d commit 516a2c1
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions crates/experimentation_platform/src/api/experiments/handlers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -529,6 +529,15 @@ async fn list_experiments(
) -> superposition::Result<HttpResponse> {
let DbConnection(mut conn) = db_conn;

if let Some(true) = pagination_params.all {
let result = experiments::experiments.get_results::<Experiment>(&mut conn)?;
return Ok(HttpResponse::Ok().json(ExperimentsResponse {
total_pages: 1,
total_items: result.len() as i64,
data: result.into_iter().map(ExperimentResponse::from).collect(),
}));
}

let max_event_timestamp: Option<NaiveDateTime> = event_log::event_log
.filter(event_log::table_name.eq("experiments"))
.select(diesel::dsl::max(event_log::timestamp))
Expand Down Expand Up @@ -564,15 +573,6 @@ async fn list_experiments(
let filters = filters.into_inner();
let base_query = query_builder(&filters);

if let Some(true) = pagination_params.all {
let result = base_query.get_results::<Experiment>(&mut conn)?;
return Ok(HttpResponse::Ok().json(ExperimentsResponse {
total_pages: 1,
total_items: result.len() as i64,
data: result.into_iter().map(ExperimentResponse::from).collect(),
}));
}

let count_query = query_builder(&filters);
let number_of_experiments = count_query.count().get_result(&mut conn)?;
let limit = pagination_params.count.unwrap_or(10);
Expand Down

0 comments on commit 516a2c1

Please sign in to comment.