further refactorings and tests

one test is failing, will fix that next time
This commit is contained in:
Reinier Balt 2011-11-28 23:38:57 +01:00
parent 80d8d2b67a
commit 2349bee535
8 changed files with 289 additions and 182 deletions

View file

@ -5,33 +5,32 @@
&y_ticks=5,10,5&
&filled_bar=50,0x9933CC,0x8010A0&
&values=
<% @count = @max_days > @cut_off*7 ? @cut_off : @max_days/7
@count = @count.to_i
0.upto @count-1 do |i| -%>
<% @count = @max_weeks > @cut_off ? @cut_off : @max_weeks
0.upto @count.to_i-1 do |i| -%>
<%= @actions_completion_time_hash[i] -%>,
<% end -%>
<%
<%
@sum=0
@count.upto @max_days/7 do |i|
@count.upto @max_weeks do |i|
@sum += @actions_completion_time_hash[i]
end -%>
<%=@sum%>&
&line_2=2,0xFF0000&
&values_2=
<% total=0
@count = @max_days > @cut_off*7 ? @cut_off : @max_days/7
@count = @max_weeks > @cut_off ? @cut_off : @max_weeks
0.upto @count-1 do |i|
total += @actions_completion_time_hash[i]*100.0/@sum_actions -%>
total += @actions_completion_time_hash[i]*100.0/@actions_completion_time.count -%>
<%= total -%>,
<% end -%>
<%= total+@sum*100.0/@sum_actions%>&
<%= total+@sum*100.0/@actions_completion_time.count%>&
&x_labels=within 1,
<% 1.upto @count-1 do |i| -%>
<%= i %>-<%= i+1 %>,
<% end -%>
> <%= @count %>&
&y_min=0&
<% # add one to @max for people who have no actions completed yet.
<% # add one to @max for people who have no actions completed yet.
# OpenFlashChart cannot handle y_max=0 -%>
&y_max=<%=1+@max_actions+@max_actions/10-%>&
&show_y2=true&