fix survey_b result and export value ( float )

This commit is contained in:
Spen 2013-10-15 11:13:15 +08:00 committed by Manson Wang
parent c9a235c802
commit 7e0657d983
2 changed files with 9 additions and 7 deletions

View File

@ -184,7 +184,7 @@
<td><%= t('survey_b.no_data') %></td>
<% @tcount = @tcount + @results[i_key]['count'] %>
<% else %>
<td><%= ( ( @results[i_key]['sum'].to_f / t('survey_b.questions').count.to_f ) / @results[i_key]['count'].to_f ).round(2) %></td>
<td><%= sprintf("%.2f", ( @results[i_key]['sum'].to_f / t('survey_b.questions').count.to_f ) / @results[i_key]['count'].to_f ) %></td>
<% @tcount = @tcount + (( @results[i_key]['sum'].to_f / t('survey_b.questions').count.to_f ) / @results[i_key]['count'].to_f ) %>
<% end %>
<% end %>
@ -198,7 +198,7 @@
<td><%= t('survey_b.no_data') %></td>
<% @tcount = @tcount + @results[i_key]['count'] %>
<% else %>
<td><%= ( ( @results[i_key]['sum7'].to_f / 7.0 ) / @results[i_key]['count'].to_f ).round(2) %></td>
<td><%= sprintf("%.2f", ( @results[i_key]['sum7'].to_f / 7.0 ) / @results[i_key]['count'].to_f ) %></td>
<% @tcount = @tcount + ( ( @results[i_key]['sum7'].to_f / 7.0 ) / @results[i_key]['count'].to_f ) %>
<% end %>
<% end %>
@ -223,7 +223,7 @@
<td><%= t('survey_b.no_data') %></td>
<% @tcount = @tcount + @results[i_key]['count'] %>
<% else %>
<td><%= ( @results[i_key][q_key].to_f / @results[i_key]['count'].to_f ).round(2) %></td>
<td><%= sprintf("%.2f", ( @results[i_key][q_key].to_f / @results[i_key]['count'].to_f )) %></td>
<% @tcount = @tcount + ( @results[i_key][q_key].to_f / @results[i_key]['count'].to_f ) %>
<% end %>
<% end %>

View File

@ -30,14 +30,16 @@
<% if @results[i_key]['count'] == 0 %>
<%= t('survey_b.no_data') %>
<% else %>
<%= ( ( @results[i_key]['sum'].to_f / t('survey_b.questions').count.to_f ) / @results[i_key]['count'].to_f ).round(2) %>
<%= sprintf("%.2f", ( @results[i_key]['sum'].to_f / t('survey_b.questions').count.to_f ) / @results[i_key]['count'].to_f ) %>
<%#= ( ( @results[i_key]['sum'].to_f / t('survey_b.questions').count.to_f ) / @results[i_key]['count'].to_f ).round(2) %>
<% end %>
</td>
<td>
<% if @results[i_key]['count'] == 0 %>
<%= t('survey_b.no_data') %>
<% else %>
<%= ( ( @results[i_key]['sum7'].to_f / 7.0 ) / @results[i_key]['count'].to_f ).round(2) %>
<%= sprintf("%.2f", ( @results[i_key]['sum7'].to_f / 7.0 ) / @results[i_key]['count'].to_f ) %>
<%#= ( ( @results[i_key]['sum7'].to_f / 7.0 ) / @results[i_key]['count'].to_f ).round(2) %>
<% end %>
</td>
<td>
@ -48,7 +50,8 @@
<% if @results[i_key]['count'] == 0 %>
<%= t('survey_b.no_data') %>
<% else %>
<%= ( @results[i_key][q_key].to_f / @results[i_key]['count'].to_f ).round(2) %>
<%= sprintf("%.2f", ( @results[i_key][q_key].to_f / @results[i_key]['count'].to_f )) %>
<%#= ( @results[i_key][q_key].to_f / @results[i_key]['count'].to_f ).round(2) %>
<% end %>
</td>
<% end %>
@ -92,7 +95,6 @@
//bar
var data_bar_<%= item %> = google.visualization.arrayToDataTable([
['<%= t("survey_b.#{item}_label") %>', '%'],
<% @results[item].each do |institution, count| %>