Class: Analytics::CycleAnalytics::Stage
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- Analytics::CycleAnalytics::Stage
- Includes:
- Parentable, Stageable
- Defined in:
- app/models/analytics/cycle_analytics/stage.rb
Constant Summary collapse
- MAX_STAGES_PER_VALUE_STREAM =
15
Constants inherited from ApplicationRecord
Constants included from HasCheckConstraints
HasCheckConstraints::NOT_NULL_CHECK_PATTERN
Constants included from ResetOnColumnErrors
ResetOnColumnErrors::MAX_RESET_PERIOD
Class Method Summary collapse
Instance Method Summary collapse
Methods included from Stageable
#default_stage?, #end_event, #end_event_identifier=, #end_event_label_based?, #events_hash_code, #params_for_end_event, #params_for_start_event, #start_event, #start_event_identifier=, #start_event_label_based?, #subject_class
Methods inherited from ApplicationRecord
===, cached_column_list, #create_or_load_association, current_transaction, declarative_enum, default_select_columns, delete_all_returning, #deleted_from_database?, id_in, id_not_in, iid_in, nullable_column?, primary_key_in, #readable_by?, safe_ensure_unique, safe_find_or_create_by, safe_find_or_create_by!, #to_ability_name, underscore, where_exists, where_not_exists, with_fast_read_statement_timeout, without_order
Methods included from Organizations::Sharding
Methods included from ResetOnColumnErrors
#reset_on_union_error, #reset_on_unknown_attribute_error
Methods included from Gitlab::SensitiveSerializableHash
Class Method Details
.distinct_stages_within_hierarchy(namespace) ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'app/models/analytics/cycle_analytics/stage.rb', line 36 def self.distinct_stages_within_hierarchy(namespace) # Looking up the whole hierarchy including all kinds (type) of Namespace records. # We're doing a custom traversal_ids query because: # - The traversal_ids based `self_and_descendants` doesn't include the ProjectNamespace records. # - The default recursive lookup also excludes the ProjectNamespace records. # # Related issue: https://gitlab.com/gitlab-org/gitlab/-/issues/386124 all_namespace_ids = Namespace .select(Arel.sql('namespaces.traversal_ids[array_length(namespaces.traversal_ids, 1)]').as('id')) .where("traversal_ids @> ('{?}')", namespace.id) with_preloaded_labels .where(parent_id: all_namespace_ids) .select("DISTINCT ON(stage_event_hash_id) #{quoted_table_name}.*") end |
Instance Method Details
#to_global_id ⇒ Object
29 30 31 32 33 34 |
# File 'app/models/analytics/cycle_analytics/stage.rb', line 29 def to_global_id return super if persisted? # Returns default name as the id for built in stages at the FOSS level name end |