Skip to content
代码片段 群组 项目
提交 0ff4d972 编辑于 作者: Kamil Trzciński's avatar Kamil Trzciński
浏览文件

Merge branch '406357-cablett-value-stream-ordering' into 'master'

Deterministic ordering of group value streams

See merge request https://gitlab.com/gitlab-org/gitlab/-/merge_requests/121962



Merged-by: default avatarKamil Trzciński <ayufan@ayufan.eu>
Approved-by: default avatarFelipe Artur <fcardozo@gitlab.com>
Approved-by: default avatarSincheol (David) Kim <dkim@gitlab.com>
Approved-by: default avatarAdam Hegyi <ahegyi@gitlab.com>
Approved-by: default avatarKamil Trzciński <ayufan@ayufan.eu>
Co-authored-by: default avatarcablett <cablett@gitlab.com>
No related branches found
No related tags found
无相关合并请求
......@@ -21,6 +21,7 @@ class ValueStream < ApplicationRecord
scope :preload_associated_models, -> {
includes(:namespace, stages: [:namespace, :end_event_label, :start_event_label])
}
scope :order_by_name_asc, -> { order(arel_table[:name].lower.asc) }
after_save :ensure_aggregation_record_presence
......
......@@ -105,7 +105,7 @@ def stage_update_params
end
def value_streams
@value_streams ||= namespace.value_streams.preload_associated_models
@value_streams ||= namespace.value_streams.preload_associated_models.order_by_name_asc
end
def serialize_value_stream(result)
......
......@@ -27,6 +27,20 @@
end
end
describe 'scopes' do
let_it_be(:group) { create(:group) }
describe '.order_by_name_asc' do
let_it_be(:stream1) { create(:cycle_analytics_value_stream, namespace: group, name: 'Bbb') }
let_it_be(:stream2) { create(:cycle_analytics_value_stream, namespace: group, name: 'aaa') }
let_it_be(:stream3) { create(:cycle_analytics_value_stream, namespace: group, name: 'Aaa') }
it 'returns in case-insensitive alphabetical order' do
expect(described_class.order_by_name_asc).to eq [stream2, stream3, stream1]
end
end
end
describe 'ordering of stages' do
let(:group) { create(:group) }
let(:value_stream) do
......
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册