Commit bbf808b4c61e9a1c94168ef3cf78fd86b37867ba

Authored by Joao M. M. da Silva + Jefferson Fernandes
Committed by Paulo Meireles
1 parent 8f344c49

[Mezuro] Draft to Google Charts implementation in show_history

plugins/mezuro/controllers/mezuro_plugin_profile_controller.rb
@@ -28,7 +28,7 @@ class MezuroPluginProfileController < ProfileController @@ -28,7 +28,7 @@ class MezuroPluginProfileController < ProfileController
28 date = params[:date] 28 date = params[:date]
29 date.nil? ? content.project_result : content.get_date_result(date) 29 date.nil? ? content.project_result : content.get_date_result(date)
30 module_result = content.module_result(params[:module_name]) 30 module_result = content.module_result(params[:module_name])
31 - render :partial => 'content_viewer/module_result', :locals => { :module_result => module_result} 31 + render :partial => 'content_viewer/module_result', :locals => { :module_result => module_result}
32 end 32 end
33 33
34 def project_tree 34 def project_tree
@@ -43,16 +43,14 @@ class MezuroPluginProfileController < ProfileController @@ -43,16 +43,14 @@ class MezuroPluginProfileController < ProfileController
43 metric_name = params[:metric_name] 43 metric_name = params[:metric_name]
44 content = profile.articles.find(params[:id]) 44 content = profile.articles.find(params[:id])
45 module_history = content.result_history(params[:module_name]) 45 module_history = content.result_history(params[:module_name])
46 - date_history = module_history.collect { |module_result| module_result.date }  
47 score_history = (module_history.collect { |module_result| (module_result.metric_results.select { |metric_result| metric_result.metric.name.delete("() ") == metric_name })[0] }).collect { |metric_result| metric_result.value } 46 score_history = (module_history.collect { |module_result| (module_result.metric_results.select { |metric_result| metric_result.metric.name.delete("() ") == metric_name })[0] }).collect { |metric_result| metric_result.value }
48 - render :partial => 'content_viewer/score_history', :locals => {:score_history => score_history, :date_history => date_history } 47 + render :partial => 'content_viewer/score_history', :locals => {:score_history => score_history}
49 end 48 end
50 49
51 def module_grade_history 50 def module_grade_history
52 content = profile.articles.find(params[:id]) 51 content = profile.articles.find(params[:id])
53 modules_results = content.result_history(params[:module_name]) 52 modules_results = content.result_history(params[:module_name])
54 - date_history = modules_results.collect { |module_result| module_result.date }  
55 score_history = modules_results.collect { |module_result| module_result.grade } 53 score_history = modules_results.collect { |module_result| module_result.grade }
56 - render :partial => 'content_viewer/score_history', :locals => {:date_history => date_history, :score_history => score_history } 54 + render :partial => 'content_viewer/score_history', :locals => {:score_history => score_history}
57 end 55 end
58 end 56 end
plugins/mezuro/views/content_viewer/_score_history.rhtml
1 -<table width="100%">  
2 - <% cont = 0 %>  
3 - <% date_history.each do |date| %>  
4 - <tr>  
5 - <td width="70%"> <b> <%= date %> </b> </td>  
6 - <td width="30%"> <%= MezuroPlugin::Helpers::ContentViewerHelper.format_grade(score_history[cont]) %> </td>  
7 - </tr>  
8 - <% cont = cont + 1 %>  
9 - <% end %>  
10 - </table> 1 +<tr>
  2 + <div><%= MezuroPlugin::Helpers::ContentViewerHelper.generate_chart(score_history) %></div>
  3 +</tr>