File tree Expand file tree Collapse file tree 1 file changed +15
-10
lines changed
Expand file tree Collapse file tree 1 file changed +15
-10
lines changed Original file line number Diff line number Diff line change 1+ # input: daily total and a distribution percentage
2+ # output values per interval
13class IntervalValueRandomizer
2- def initialize ( sum , value )
3- @sum = sum # rename
4- @value = value # rename
4+ def initialize ( daily_total , distribution_factor )
5+ @daily_total = daily_total
6+ @distribution_factor = distribution_factor # rename
57 end
68
79 def calls
8- ( @value * avg_per_interval * random_de_or_increase ) . floor
10+ ( @distribution_factor * average_value * random_modifier ) . floor
911 end
1012
1113 def handled_calls
1214 0
1315 end
1416
1517 def aht
16- return 0 if calls == 0
17- ( random_de_or_increase * avg_per_interval * random_de_or_increase + 100 ) . floor
18+ return 0 if calls . zero?
19+
20+ ( random_modifier * average_value * random_modifier + 100 ) . floor
1821 end
1922
20- def avg_per_interval
21- @sum / 96
23+ private
24+
25+ def average_value
26+ @daily_total / 96
2227 end
2328
24- def random_de_or_increase
29+ def random_modifier
2530 rand ( 0.96 ..1.1 )
2631 end
27- end
32+ end
You can’t perform that action at this time.
0 commit comments