Commit b7fb1805 authored by Aakriti Gupta's avatar Aakriti Gupta

Rename ConvDev model and presenter to DevOpsScore

The routes and controller stay unchanged.
parent 973c75d7
......@@ -3,7 +3,7 @@
class InstanceStatistics::ConversationalDevelopmentIndexController < InstanceStatistics::ApplicationController
# rubocop: disable CodeReuse/ActiveRecord
def index
@metric = ConversationalDevelopmentIndex::Metric.order(:created_at).last&.present
@metric = DevOpsScore::Metric.order(:created_at).last&.present
end
# rubocop: enable CodeReuse/ActiveRecord
end
# frozen_string_literal: true
module ConversationalDevelopmentIndexHelper
module DevOpsScoreHelper
def score_level(score)
if score < 33.33
'low'
......
# frozen_string_literal: true
module ConversationalDevelopmentIndex
module DevOpsScore
class Card
attr_accessor :metric, :title, :description, :feature, :blog, :docs
......
# frozen_string_literal: true
module ConversationalDevelopmentIndex
module DevOpsScore
class IdeaToProductionStep
attr_accessor :metric, :title, :features
......
# frozen_string_literal: true
module ConversationalDevelopmentIndex
module DevOpsScore
class Metric < ApplicationRecord
include Presentable
......
# frozen_string_literal: true
module ConversationalDevelopmentIndex
module DevOpsScore
class MetricPresenter < Gitlab::View::Presenter::Simple
def cards
[
......
......@@ -38,7 +38,7 @@ class SubmitUsagePingService
def store_metrics(response)
return unless response['conv_index'].present?
ConversationalDevelopmentIndex::Metric.create!(
DevOpsScore::Metric.create!(
response['conv_index'].slice(*METRICS)
)
end
......
Gitlab::Seeder.quiet do
conversational_development_index_metric = ConversationalDevelopmentIndex::Metric.new(
dev_ops_score_metric = DevOpsScore::Metric.new(
leader_issues: 10.2,
instance_issues: 3.2,
......@@ -31,10 +31,10 @@ Gitlab::Seeder.quiet do
instance_service_desk_issues: 15.1
)
if conversational_development_index_metric.save
if dev_ops_score_metric.save
print '.'
else
puts conversational_development_index_metric.errors.full_messages
puts dev_ops_score_metric.errors.full_messages
print 'F'
end
end
# frozen_string_literal: true
FactoryBot.define do
factory :dev_ops_score_metric, class: ConversationalDevelopmentIndex::Metric do
factory :dev_ops_score_metric, class: DevOpsScore::Metric do
leader_issues { 9.256 }
instance_issues { 1.234 }
percentage_issues { 13.331 }
......
......@@ -2,7 +2,7 @@
require 'spec_helper'
describe ConversationalDevelopmentIndex::Metric do
describe DevOpsScore::Metric do
let(:conv_dev_index) { create(:dev_ops_score_metric) }
describe '#percentage_score' do
......
......@@ -2,7 +2,7 @@
require 'spec_helper'
describe ConversationalDevelopmentIndex::MetricPresenter do
describe DevOpsScore::MetricPresenter do
subject { described_class.new(metric) }
let(:metric) { build(:dev_ops_score_metric) }
......
......@@ -46,12 +46,12 @@ describe SubmitUsagePingService do
stub_response(with_conv_index_params)
expect { subject.execute }
.to change { ConversationalDevelopmentIndex::Metric.count }
.to change { DevOpsScore::Metric.count }
.by(1)
expect(ConversationalDevelopmentIndex::Metric.last.leader_issues).to eq 10.2
expect(ConversationalDevelopmentIndex::Metric.last.instance_issues).to eq 3.2
expect(ConversationalDevelopmentIndex::Metric.last.percentage_issues).to eq 31.37
expect(DevOpsScore::Metric.last.leader_issues).to eq 10.2
expect(DevOpsScore::Metric.last.instance_issues).to eq 3.2
expect(DevOpsScore::Metric.last.percentage_issues).to eq 31.37
end
end
......
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