Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
ea838141
Commit
ea838141
authored
Jun 02, 2017
by
Adam Niedzielski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use sum instead of map + inject
parent
da1f5255
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
3 deletions
+3
-3
app/models/conversational_development_index/idea_to_production_step.rb
...nversational_development_index/idea_to_production_step.rb
+2
-2
app/presenters/conversational_development_index/metric_presenter.rb
...ters/conversational_development_index/metric_presenter.rb
+1
-1
No files found.
app/models/conversational_development_index/idea_to_production_step.rb
View file @
ea838141
...
...
@@ -9,9 +9,9 @@ module ConversationalDevelopmentIndex
end
def
percentage_score
sum
=
features
.
map
do
|
feature
|
sum
=
features
.
sum
do
|
feature
|
metric
.
percentage_score
(
feature
)
end
.
inject
(:
+
)
end
sum
/
features
.
size
.
to_f
end
...
...
app/presenters/conversational_development_index/metric_presenter.rb
View file @
ea838141
...
...
@@ -138,7 +138,7 @@ module ConversationalDevelopmentIndex
end
def
average_percentage_score
cards
.
map
(
&
:percentage_score
).
inject
(:
+
)
/
cards
.
size
.
to_f
cards
.
sum
(
&
:percentage_score
)
/
cards
.
size
.
to_f
end
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment