Commit 220a47c89c5d9440e977fef745d658c9853d7291
1 parent
fa512fa6
Exists in
theme-brasil-digital-from-staging
and in
9 other branches
virtuoso: added action to force harvest from start
Showing
3 changed files
with
8 additions
and
2 deletions
Show diff stats
plugins/virtuoso/controllers/virtuoso_plugin_admin_controller.rb
| @@ -15,7 +15,7 @@ class VirtuosoPluginAdminController < AdminController | @@ -15,7 +15,7 @@ class VirtuosoPluginAdminController < AdminController | ||
| 15 | 15 | ||
| 16 | def force_harvest | 16 | def force_harvest |
| 17 | harvest = VirtuosoPlugin::DspaceHarvest.new(environment) | 17 | harvest = VirtuosoPlugin::DspaceHarvest.new(environment) |
| 18 | - harvest.start | 18 | + harvest.start(params[:from_start]) |
| 19 | session[:notice] = _('Harvest started') | 19 | session[:notice] = _('Harvest started') |
| 20 | redirect_to :action => :index | 20 | redirect_to :action => :index |
| 21 | end | 21 | end |
plugins/virtuoso/lib/virtuoso_plugin/dspace_harvest.rb
| @@ -49,8 +49,13 @@ class VirtuosoPlugin::DspaceHarvest | @@ -49,8 +49,13 @@ class VirtuosoPlugin::DspaceHarvest | ||
| 49 | puts "ending harvest #{harvest_time}" | 49 | puts "ending harvest #{harvest_time}" |
| 50 | end | 50 | end |
| 51 | 51 | ||
| 52 | - def start | 52 | + def start(from_start = false) |
| 53 | if find_job.empty? | 53 | if find_job.empty? |
| 54 | + if from_start | ||
| 55 | + settings.last_harvest = nil | ||
| 56 | + settings.save! | ||
| 57 | + end | ||
| 58 | + | ||
| 54 | job = VirtuosoPlugin::DspaceHarvest::Job.new(@environment.id) | 59 | job = VirtuosoPlugin::DspaceHarvest::Job.new(@environment.id) |
| 55 | Delayed::Job.enqueue(job) | 60 | Delayed::Job.enqueue(job) |
| 56 | end | 61 | end |
plugins/virtuoso/views/virtuoso_plugin_admin/index.html.erb
| @@ -29,6 +29,7 @@ | @@ -29,6 +29,7 @@ | ||
| 29 | <%= _('Running...') %> | 29 | <%= _('Running...') %> |
| 30 | <% else %> | 30 | <% else %> |
| 31 | <%= button :next, _('Force harvest'), :action => :force_harvest %> | 31 | <%= button :next, _('Force harvest'), :action => :force_harvest %> |
| 32 | + <%= button :next, _('Force harvest from start'), :action => :force_harvest, :from_start => true %> | ||
| 32 | <% end %> | 33 | <% end %> |
| 33 | </div> | 34 | </div> |
| 34 | </div> | 35 | </div> |