Skip to content

Commit

Permalink
fix: small syntax improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
ccerv1 committed Nov 22, 2024
1 parent 181db3c commit dbe64fc
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions warehouse/metrics_mesh/oso_metrics/time_to_first_response.sql
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
select
@metrics_sample_date(time_to_first_response_events.time) as metrics_sample_date,
@metrics_sample_date(time_to_first_response_events.responded_at) as metrics_sample_date,
time_to_first_response_events.event_source,
time_to_first_response_events.to_artifact_id,
'' as from_artifact_id,
@metric_name() as metric,
AVG(time_to_first_response_events.amount) as amount
from (
select
responded_at as `time`,
responded_at,
to_artifact_id,
event_source,
time_to_first_response_days as amount
Expand Down Expand Up @@ -46,22 +46,22 @@ from (
'ISSUE_CLOSED',
'ISSUE_COMMENT'
)
) as resp
) as resp_events
on
start_events.issue_number = resp.issue_number
and start_events.to_artifact_id = resp.to_artifact_id
and start_events.creator_id != resp.responder_id
start_events.issue_number = resp_events.issue_number
and start_events.to_artifact_id = resp_events.to_artifact_id
and start_events.creator_id != resp_events.responder_id
and (
(
start_events.event_type = 'ISSUE_OPENED'
and resp.event_type in (
and resp_events.event_type in (
'ISSUE_COMMENT', 'ISSUE_CLOSED'
)
)
or
(
start_events.event_type = 'PULL_REQUEST_OPENED'
and resp.event_type in (
and resp_events.event_type in (
'PULL_REQUEST_REVIEW_COMMENT', 'PULL_REQUEST_MERGED'
)
)
Expand All @@ -72,7 +72,7 @@ from (
start_events.created_at
) as time_to_first_response
) as time_to_first_response_events
where time_to_first_response_events.time BETWEEN @metrics_start('DATE') AND @metrics_end('DATE')
where time_to_first_response_events.responded_at BETWEEN @metrics_start('DATE') AND @metrics_end('DATE')
group by
metrics_sample_date,
time_to_first_response_events.event_source,
Expand Down

0 comments on commit dbe64fc

Please sign in to comment.