Skip to content

Commit

Permalink
Merge pull request #372 from Codeminer42/sprint-by-velocity
Browse files Browse the repository at this point in the history
[WIP] Add field with the number of required sprints to calculate the velocity of a project
  • Loading branch information
andrerpbts authored Oct 17, 2018
2 parents d2c1730 + 8cb7208 commit 486f3b7
Show file tree
Hide file tree
Showing 11 changed files with 56 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
### Added
- Option to archive teams
- Added pusher-fake to the project
- Field velocity_strategy to projects

### Fixed
- Fixed locale change when accessing user edit page
Expand Down
1 change: 1 addition & 0 deletions app/api/entities/project.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ class Entities::Project < Entities::BaseEntity
expose :iteration_start_day
expose :iteration_length
expose :default_velocity
expose :velocity_strategy
expose :velocity, if: { type: :full }
expose :volatility, if: { type: :full }
expose :teams, using: Entities::Team
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/projects_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ def allowed_params
.fetch(:project)
.permit(:name, :point_scale, :default_velocity, :tag_group_id, :start_date,
:iteration_start_day, :iteration_length, :import, :archived,
:disallow_join, :mail_reports)
:disallow_join, :mail_reports, :velocity_strategy)
end

def fluid_layout
Expand Down
8 changes: 8 additions & 0 deletions app/helpers/projects_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -107,4 +107,12 @@ def formatted_standard_deviation(standard_deviation)
def inverse_story_flow
'pressed' if @story_flow[:current].eql?(@story_flow[:default])
end

# Returns an array of valid velocity strategy options suitable for use in
# a select helper.
def velocity_strategy_options
(1..4).collect do |iterations|
[I18n.t('n velocity strategy', count: iterations), iterations]
end
end
end
11 changes: 10 additions & 1 deletion app/views/projects/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,15 @@
<%= f.text_field :default_velocity, length: 2, size: 3, class: 'form-control auth-form-control' %>
</div>

<div class="form-group">
<%= f.label :velocity_strategy %>
<%= f.select :velocity_strategy,
velocity_strategy_options,
{},
{ class:'form-control auth-form-control' }
%>
</div>

<div class="form-group date-form-group">
<%= f.label :start_date, class: 'control-label' %> <br>
<%= f.date_select :start_date, {}, { class: 'form-control auth-form-control' } %>
Expand Down Expand Up @@ -52,7 +61,7 @@
<%= f.label :mail_reports, class: 'control-label' %>
<%= f.check_box :mail_reports %>
</div>

<div class="btn-group actions pull-right clearfix">
<%= f.submit nil, class: 'btn btn-primary btn-form' %>

Expand Down
5 changes: 5 additions & 0 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,10 @@ en:
one: '1 week'
other: '%{count} weeks'

n velocity strategy:
one: 'Average of 1 iteration'
other: 'Average of %{count} iterations'

keycuts:
keyboard_shortcuts: Keyboard shortcuts
help: Help (this)
Expand Down Expand Up @@ -178,6 +182,7 @@ en:
default_velocity: 'Default velocity'
archived: 'Archived'
mail_reports: 'Send reports via mail'
velocity_strategy: 'Velocity strategy'
story:
title: 'Title'
description: 'Description'
Expand Down
5 changes: 5 additions & 0 deletions config/locales/pt-BR.yml
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,10 @@ pt-BR:
one: '1 semana'
other: '%{count} semanas'

n velocity strategy:
one: 'Média de 1 iteração'
other: 'Média de %{count} iterações'

keycuts:
keyboard_shortcuts: Atalhos de teclado
help: Ajuda (this)
Expand Down Expand Up @@ -175,6 +179,7 @@ pt-BR:
default_velocity: 'Velocidade padrão'
archived: 'Arquivado'
mail_reports: 'Enviar relatórios por email'
velocity_strategy: 'Estratégia de velocidade'
story:
title: 'Título'
description: 'Descrição'
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class AddVelocityStrategyToProjects < ActiveRecord::Migration
def change
add_column :projects, :velocity_strategy, :integer, default: 3
end
end
3 changes: 2 additions & 1 deletion db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema.define(version: 20170914172941) do
ActiveRecord::Schema.define(version: 20180823124914) do

# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
Expand Down Expand Up @@ -170,6 +170,7 @@
t.boolean "disallow_join", default: true, null: false
t.integer "tag_group_id"
t.boolean "mail_reports", default: true
t.integer "velocity_strategy", default: 3
end

add_index "projects", ["slug"], name: "index_projects_on_slug", unique: true, using: :btree
Expand Down
6 changes: 6 additions & 0 deletions spec/api/entities/project_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@
it { expect(subject[:volatility]).to be_nil }
it { expect(subject[:mail_reports]).to be_truthy }

it do
expect(
subject[:velocity_strategy]
).to eq(project.velocity_strategy)
end

context 'when call it with full type' do
subject { described_class.represent(project, type: :full).as_json }

Expand Down
12 changes: 12 additions & 0 deletions spec/helpers/projects_helper_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,16 @@
end
end
end

describe '#velocity_strategy_options' do
subject(:options) { helper.velocity_strategy_options }

it 'returns an array containing translated options to use in a select' do
(1..4).each do |iteration|
expect(options).to include(
[I18n.t('n velocity strategy', count: iteration), iteration]
)
end
end
end
end

0 comments on commit 486f3b7

Please sign in to comment.