每個循環之後如何添加「0」,在Ruby中每個循環後(在數據:系列的一部分)如何添加「0」,在Ruby中
So first loop would
show only the value
next loop 0,value
next loop 0,0,value
next loop 0,0,0,value
etc..
series: [
<% @prot = ProjectTask.where("project_id = ? AND taskType = ?" ,@project.id, "Pre-Sales")%>
<% @prot.each do |prt| %>
<% hoursSum = 0 %>
{
name: '<%= prt.task_name%>',
data: [(here after each loop of @prot i want to add "0," here)<% @taskHours = Effort.where(:project_task_id => prt.id) %>
<% @taskHours.each do |th| %>
<% hoursSum = hoursSum + th.hours %>
<% end %>
<%= hoursSum%>
]
},<% end %>