Commit bbf808b4c61e9a1c94168ef3cf78fd86b37867ba
Committed by
Paulo Meireles
1 parent
8f344c49
Exists in
staging
and in
42 other branches
[Mezuro] Draft to Google Charts implementation in show_history
Showing
2 changed files
with
6 additions
and
15 deletions
Show diff stats
plugins/mezuro/controllers/mezuro_plugin_profile_controller.rb
| ... | ... | @@ -28,7 +28,7 @@ class MezuroPluginProfileController < ProfileController |
| 28 | 28 | date = params[:date] |
| 29 | 29 | date.nil? ? content.project_result : content.get_date_result(date) |
| 30 | 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 | 32 | end |
| 33 | 33 | |
| 34 | 34 | def project_tree |
| ... | ... | @@ -43,16 +43,14 @@ class MezuroPluginProfileController < ProfileController |
| 43 | 43 | metric_name = params[:metric_name] |
| 44 | 44 | content = profile.articles.find(params[:id]) |
| 45 | 45 | module_history = content.result_history(params[:module_name]) |
| 46 | - date_history = module_history.collect { |module_result| module_result.date } | |
| 47 | 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 | 48 | end |
| 50 | 49 | |
| 51 | 50 | def module_grade_history |
| 52 | 51 | content = profile.articles.find(params[:id]) |
| 53 | 52 | modules_results = content.result_history(params[:module_name]) |
| 54 | - date_history = modules_results.collect { |module_result| module_result.date } | |
| 55 | 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 | 55 | end |
| 58 | 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> | ... | ... |