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