check foreigner lists

This commit is contained in:
phyusin
2018-04-04 11:55:45 +06:30
parent 3008dc0f3c
commit 907fd671c8
2 changed files with 128 additions and 9 deletions

View File

@@ -56,6 +56,7 @@
<% total_female = 0 %>
<% total_local = 0 %>
<% total_customer = 0 %>
<% total_foreigner = 0 %>
<% if !@surveys.nil? %>
<% @surveys.each do |survey| %>
<% total_child = total_child.to_i + survey.child.to_i %>
@@ -80,8 +81,11 @@
<% foreigner_lists = foreign.split(",") %>
<% if !foreigner_lists.empty? %>
<% foreigner_lists.each do |fgn| %>
<% unless fgn.match(/[^[:digit:]]+/)
total_foreigner = total_foreigner.to_i + fgn.to_i
end %>
<% if !fgn.scan(/\D/).empty? %>
<%= fgn %> :<% end %> <%= fgn.to_i unless fgn.match(/[^[:digit:]]+/) %><br>
<%= fgn %> :<% end %> <%= fgn.to_i unless fgn.match(/[^[:digit:]]+/) %><br>
<% end %>
<% end %>
<% end %>
@@ -97,7 +101,8 @@
<td><strong><%= total_male %></strong></td>
<td><strong><%= total_female %></strong></td>
<td><strong><%= total_customer %></strong></td>
<td colspan="2"><strong><%= total_local %></strong></td>
<td><strong><%= total_local %></strong></td>
<td><strong><%= total_foreigner %></strong></td>
</tr>
</tbody>
</table>