mirror of
https://github.com/TracksApp/tracks.git
synced 2026-01-02 07:18:49 +01:00
fasterer: hash#fetch with block is faster
hash#fetch with block is faster than hash#fetch with second parameter
This commit is contained in:
parent
ddd9c07d3b
commit
0d224a5fe9
1 changed files with 1 additions and 1 deletions
|
|
@ -448,7 +448,7 @@ class StatsController < ApplicationController
|
|||
end
|
||||
|
||||
def three_month_avg(set, i)
|
||||
(set.fetch(i,0) + set.fetch(i+1,0) + set.fetch(i+2,0)) / 3.0
|
||||
(set.fetch(i){ 0 } + set.fetch(i+1){ 0 } + set.fetch(i+2){ 0 }) / 3.0
|
||||
end
|
||||
|
||||
def set_three_month_avg(set,upper_bound)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue