File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed
Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -4,10 +4,13 @@ class ProjectsController < BaseController
44 # GET /api/v1/projects
55 # Optional query params:
66 # - with_drift: "true" to filter only projects with drifting environments
7+ # - with_issues: "true" to filter projects with drift OR error environments
78 def index
89 projects = Project . includes ( :environments ) . order ( :name )
910
10- if params [ :with_drift ] == "true"
11+ if params [ :with_issues ] == "true"
12+ projects = projects . joins ( :environments ) . where ( environments : { status : [ :drift , :error ] } ) . distinct
13+ elsif params [ :with_drift ] == "true"
1114 projects = projects . joins ( :environments ) . where ( environments : { status : :drift } ) . distinct
1215 end
1316
@@ -31,7 +34,8 @@ def project_json(project, include_environments: false)
3134 aggregated_status : project . aggregated_status ,
3235 last_checked_at : project . last_checked_at ,
3336 environment_count : project . environments . count ,
34- drift_environment_count : project . environments . where ( status : :drift ) . count
37+ drift_environment_count : project . environments . where ( status : :drift ) . count ,
38+ error_environment_count : project . environments . where ( status : :error ) . count
3539 }
3640
3741 if include_environments
You can’t perform that action at this time.
0 commit comments