Commit ce855ed0 authored by Imre Farkas's avatar Imre Farkas

Merge branch '229118-charts-with-project-filter-seem-to-timeout' into 'master'

Fallback to `created_at` when `merged_at` is missing in Insights charts

Closes #229118

See merge request gitlab-org/gitlab!36930
parents 5d465c31 313a7a66
......@@ -287,6 +287,11 @@ The `period_field` is automatically set to:
- `merged_at` if `query.issuable_state` is `merged`
- `created_at` otherwise
NOTE: **Note:**
Until [this bug](https://gitlab.com/gitlab-org/gitlab/-/issues/26911), is resolved, you may see `created_at`
in place of `merged_at`.
`created_at` will be used instead.
### `projects`
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/10904) in [GitLab Ultimate](https://about.gitlab.com/pricing/) 12.4.
......
---
title: Fallback to `created_at` when `merged_at` is missing in Insights charts
merge_request: 36930
author:
type: fixed
......@@ -62,7 +62,8 @@ module Gitlab
# }
def issuables_grouped_by_normalized_period
@issuables_grouped_by_normalized_period ||= issuables.group_by do |issuable|
normalized_time(issuable.public_send(period_field)) # rubocop:disable GitlabSecurity/PublicSend
time_field = issuable.public_send(period_field) || issuable.created_at # rubocop:disable GitlabSecurity/PublicSend
normalized_time(time_field)
end
end
......
......@@ -133,9 +133,9 @@ RSpec.describe Gitlab::Insights::Reducers::CountPerPeriodReducer do
context 'with merged merge requests' do
include_context 'Insights merge requests reducer context', :merged
# Populate the MR metrics' merged_at
# Populate the MR metrics' merged_at, except for issuable3 to reproduce a real use-case where merged_at is null.
before do
(0..3).each do |i|
(0..2).each do |i|
merge_request = public_send("issuable#{i}")
merge_request_metrics_service = MergeRequestMetricsService.new(merge_request.metrics)
Event.transaction do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment