From 1df443cf0e4e50a4049082355dbcc8e47de5c0ce Mon Sep 17 00:00:00 2001 From: Cody Cutrer Date: Wed, 31 Aug 2011 09:37:30 -0600 Subject: [PATCH] show pending sis batch count on sis imports page Change-Id: I9a7ac217a00ecf8f445e94438f89f2a0e0a3fa03 Reviewed-on: https://gerrit.instructure.com/5358 Tested-by: Hudson Reviewed-by: JT Olds --- app/models/sis_batch.rb | 4 +--- app/views/accounts/sis_import.html.erb | 11 ++++++++++- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/app/models/sis_batch.rb b/app/models/sis_batch.rb index 219a893fba3..558080a3d1a 100644 --- a/app/models/sis_batch.rb +++ b/app/models/sis_batch.rb @@ -96,9 +96,7 @@ class SisBatch < ActiveRecord::Base end handle_asynchronously :process, :strand => proc { |sis_batch| "sis_batch:account:#{sis_batch.account_id}" }, :priority => Delayed::LOW_PRIORITY - named_scope :needs_processing, lambda{ - {:conditions => ["sis_batches.workflow_state = 'needs_processing'"], :order => :created_at} - } + named_scope :needs_processing, :conditions => { :workflow_state => 'created' }, :order => :created_at def fast_update_progress(val) self.progress = val diff --git a/app/views/accounts/sis_import.html.erb b/app/views/accounts/sis_import.html.erb index 4452671dcd5..94b46dc5ce7 100644 --- a/app/views/accounts/sis_import.html.erb +++ b/app/views/accounts/sis_import.html.erb @@ -59,7 +59,16 @@

<%= t(:import_log_title, "Import Progress Log") %>

- + + <% pending_batch_count = @account.sis_batches.needs_processing.count %> + <% pending_batch_count -= 1 if @current_batch && @current_batch.created? %> + <% if pending_batch_count > 0 %> +
+

<%= t(:pending_batches_title, "Pending Batches") %>

+

<%= t(:pending_batches_count, { :one => "%{count} batch waiting to be processed.", :other => "%{count} batches waiting to be processed." }, :count => pending_batch_count) %>

+
+ <% end %> + <% if show_last_batch %>

<%= t(:last_batch_title, "Last Batch") %>