diff --git a/plugins/mezuro/controllers/profile/mezuro_plugin_processing_controller.rb b/plugins/mezuro/controllers/profile/mezuro_plugin_processing_controller.rb index 47b8bb2..e969cd2 100644 --- a/plugins/mezuro/controllers/profile/mezuro_plugin_processing_controller.rb +++ b/plugins/mezuro/controllers/profile/mezuro_plugin_processing_controller.rb @@ -4,15 +4,19 @@ class MezuroPluginProcessingController < MezuroPluginProfileController def state processing = processing_for_date(params[:repository_id].to_i, params[:date]) - render :text => processing.state + if processing.error.nil? + render :text => processing.state + else + render :text => 'ERROR' + end end def processing @processing = processing_for_date(params[:repository_id].to_i, params[:date]) - if @processing.state == 'ERROR' - render :partial => 'processing_error' - else + if @processing.error.nil? render :partial => 'processing' + else + render :partial => 'processing_error' end end diff --git a/plugins/mezuro/controllers/profile/mezuro_plugin_repository_controller.rb b/plugins/mezuro/controllers/profile/mezuro_plugin_repository_controller.rb index cf24413..b94de3b 100644 --- a/plugins/mezuro/controllers/profile/mezuro_plugin_repository_controller.rb +++ b/plugins/mezuro/controllers/profile/mezuro_plugin_repository_controller.rb @@ -55,6 +55,7 @@ class MezuroPluginRepositoryController < MezuroPluginProfileController repository.save(project_content.project_id) if( repository.errors.empty? ) + repository.process redirect_to "/profile/#{profile.identifier}/plugin/mezuro/repository/show/#{project_content.id}?repository_id=#{repository.id}" else redirect_to_error_page repository.errors[0].message diff --git a/plugins/mezuro/public/javascripts/processing.js b/plugins/mezuro/public/javascripts/processing.js index 3b6288a..a8fb39c 100644 --- a/plugins/mezuro/public/javascripts/processing.js +++ b/plugins/mezuro/public/javascripts/processing.js @@ -72,8 +72,9 @@ function reloadProcessing(date){ function showProcessingFor(state){ repository_id = processingData('repository-id'); if (state == 'ERROR') { - jQuery('#project-state').html('
ERROR
'); + jQuery('#processing-state').html('
ERROR
'); callAction('processing', 'processing', {repository_id: repository_id}, showReadyProcessing); + showModuleResult(''); } else if (state == 'READY') { jQuery('#msg-time').html(''); @@ -129,4 +130,4 @@ function sourceNodeToggle(id){ var suffixes = ['_hidden', '_plus', '_minus']; for (var i in suffixes) jQuery('#' + id + suffixes[i]).toggle(); -} \ No newline at end of file +} diff --git a/plugins/mezuro/test/functional/profile/mezuro_plugin_module_result_controller_test.rb b/plugins/mezuro/test/functional/profile/mezuro_plugin_module_result_controller_test.rb index 0c9bf54..8cbe65c 100644 --- a/plugins/mezuro/test/functional/profile/mezuro_plugin_module_result_controller_test.rb +++ b/plugins/mezuro/test/functional/profile/mezuro_plugin_module_result_controller_test.rb @@ -21,24 +21,24 @@ class MezuroPluginModuleResultControllerTest < ActionController::TestCase should 'find module result on kalibro' do parent_module_result = ModuleResultFixtures.parent_module_result_hash - Kalibro::ModuleResult.expects(:request).with(:get_module_result, { :module_result_id => @module_result_hash[:id] }). + Kalibro::ModuleResult.expects(:request).with(:get_module_result, { :module_result_id => @module_result_hash[:id].to_i }). returns({:module_result => @module_result_hash}) - Kalibro::MetricResult.expects(:request).with(:metric_results_of, { :module_result_id => @module_result_hash[:id] }). + Kalibro::MetricResult.expects(:request).with(:metric_results_of, { :module_result_id => @module_result_hash[:id].to_i }). returns({:metric_result => @metric_result_hash}) - Kalibro::ModuleResult.expects(:request).with(:get_module_result, { :module_result_id => @module_result_hash[:parent_id] }). + Kalibro::ModuleResult.expects(:request).with(:get_module_result, { :module_result_id => @module_result_hash[:parent_id].to_i }). returns({:module_result => parent_module_result}) - Kalibro::ModuleResult.expects(:request).with(:children_of, {:module_result_id => @module_result_hash[:id]}). + Kalibro::ModuleResult.expects(:request).with(:children_of, {:module_result_id => @module_result_hash[:id].to_i}). returns({:module_result => nil}) get :module_result, :profile => @profile.identifier, :module_result_id => @module_result_hash[:id] - assert_equal @module_result_hash[:grade], assigns(:module_result).grade - assert_equal @metric_result_hash[:value], assigns(:metric_results).first.value + assert_equal @module_result_hash[:grade].to_f, assigns(:module_result).grade + assert_equal @metric_result_hash[:value].to_f, assigns(:metric_results).first.value assert_response 200 #TODO assert_select('h5', 'Metric results for: Qt-Calculator (APPLICATION)') end should 'get metric result history' do metric_name = @metric_result_hash[:configuration][:metric][:name] - Kalibro::MetricResult.expects(:request).with(:history_of_metric, { :metric_name => metric_name, :module_result_id => @module_result_hash[:id] }). + Kalibro::MetricResult.expects(:request).with(:history_of_metric, { :metric_name => metric_name, :module_result_id => @module_result_hash[:id].to_i }). returns({:date_metric_result => @date_metric_result_hash}) get :metric_result_history, :profile => @profile.identifier, :module_result_id => @module_result_hash[:id], :metric_name => metric_name assert_equal DateTime.parse(@date_metric_result_hash[:date]), assigns(:history).first.date @@ -47,7 +47,7 @@ class MezuroPluginModuleResultControllerTest < ActionController::TestCase end should 'get module result history' do - Kalibro::ModuleResult.expects(:request).with(:history_of_module, { :module_result_id => @module_result_hash[:id] }). + Kalibro::ModuleResult.expects(:request).with(:history_of_module, { :module_result_id => @module_result_hash[:id].to_i }). returns({:date_module_result => @date_module_result_hash}) get :module_result_history, :profile => @profile.identifier, :module_result_id => @module_result_hash[:id] assert_equal DateTime.parse(@date_module_result_hash[:date]), assigns(:history).first.date diff --git a/plugins/mezuro/test/functional/profile/mezuro_plugin_repository_controller_test.rb b/plugins/mezuro/test/functional/profile/mezuro_plugin_repository_controller_test.rb index dee5d4d..d265094 100644 --- a/plugins/mezuro/test/functional/profile/mezuro_plugin_repository_controller_test.rb +++ b/plugins/mezuro/test/functional/profile/mezuro_plugin_repository_controller_test.rb @@ -77,6 +77,7 @@ class MezuroPluginRepositoryControllerTest < ActionController::TestCase should 'update a repository' do Kalibro::Repository.expects(:new).returns(@repository) @repository.expects(:save).with(@content.project_id).returns(true) + Kalibro::Repository.expects(:request).with(:process_repository, {:repository_id => @repository.id}) get :update, :profile => @profile.identifier, :id => @content.id, :repository => @repository_hash assert @repository.errors.empty? assert_response :redirect -- libgit2 0.21.2