Commit 92747293d7a86a7a13351236c46c8c9e9d66e852
1 parent
fa512fa6
Exists in
staging
and in
4 other branches
virtuoso: added action to force harvest from start
Showing
4 changed files
with
15 additions
and
2 deletions
Show diff stats
plugins/virtuoso/controllers/virtuoso_plugin_admin_controller.rb
... | ... | @@ -15,7 +15,7 @@ class VirtuosoPluginAdminController < AdminController |
15 | 15 | |
16 | 16 | def force_harvest |
17 | 17 | harvest = VirtuosoPlugin::DspaceHarvest.new(environment) |
18 | - harvest.start | |
18 | + harvest.start(params[:from_start]) | |
19 | 19 | session[:notice] = _('Harvest started') |
20 | 20 | redirect_to :action => :index |
21 | 21 | end | ... | ... |
plugins/virtuoso/lib/virtuoso_plugin/dspace_harvest.rb
... | ... | @@ -49,8 +49,13 @@ class VirtuosoPlugin::DspaceHarvest |
49 | 49 | puts "ending harvest #{harvest_time}" |
50 | 50 | end |
51 | 51 | |
52 | - def start | |
52 | + def start(from_start = false) | |
53 | 53 | if find_job.empty? |
54 | + if from_start | |
55 | + settings.last_harvest = nil | |
56 | + settings.save! | |
57 | + end | |
58 | + | |
54 | 59 | job = VirtuosoPlugin::DspaceHarvest::Job.new(@environment.id) |
55 | 60 | Delayed::Job.enqueue(job) |
56 | 61 | end | ... | ... |
plugins/virtuoso/test/functional/virtuoso_plugin_admin_controller_test.rb
... | ... | @@ -35,4 +35,11 @@ class VirtuosoPluginAdminControllerTest < ActionController::TestCase |
35 | 35 | assert harvest.find_job.present? |
36 | 36 | end |
37 | 37 | |
38 | + should 'force harvest from start' do | |
39 | + get :force_harvest, :from_start => true | |
40 | + harvest = VirtuosoPlugin::DspaceHarvest.new(environment) | |
41 | + assert harvest.find_job.present? | |
42 | + assert_equal nil, harvest.settings.last_harvest | |
43 | + end | |
44 | + | |
38 | 45 | end | ... | ... |
plugins/virtuoso/views/virtuoso_plugin_admin/index.html.erb