Rails App. I have a project and a task model. Tasks have a column project_id to set the project to which they belong, and several columns of completeness to indicate the completeness of the task in time (so I have a column "completeten_at_3hours", "completeten_at_6hours, etc.), to indicate from 1 to 5 levels of completeness of the task.
Now I need graphically, with google diagrams, completeness during the tasks related to the project.
In my project controller, I have
@tasks = Tasks.where("project_id = ?", params[:id])
So, now that I have the tasks of the selected project, in @tasks, how to include data in the google script diagram?
function drawChart() {
var data = google.visualization.arrayToDataTable([
['Time', '<%= @task.name %>', '????????'],
['<%= @task.created_at %>', <%= @task.zerohours %>, '?????????'],
['<%= @task.created_at + 3.hours %>', <%= @task.threehours %>, '????????'],
['<%= @task.created_at + 6.hours %>', <%= @task.sixhours %>, '????????'],
['<%= @task.created_at + 9.hours %>', <%= @task.ninehours %>, '????????'],
['<%= @task.created_at + 12.hours %>', <%= @task.twelvehours %>, '????????']
]);
this only works for one task (the one that was just created), but how do I pass all the data contained in @tasks to the script?
, , :
<% @tasks.each do |task| %>
<%= @task.threehours %>
<%= @task.sixhours %>
<%= @task.ninehours %>
<%= @task.twelvehours %>
<% end %>
, google script?
!