coalescing_panda 4.1.5 → 4.1.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/coalescing_panda/canvas_batch.js.coffee +2 -0
- data/app/controllers/coalescing_panda/canvas_batches_controller.rb +10 -0
- data/app/models/coalescing_panda/canvas_batch.rb +2 -0
- data/app/models/coalescing_panda/workers/course_miner.rb +17 -3
- data/app/views/coalescing_panda/canvas_batches/_canvas_batch.html.haml +18 -8
- data/app/views/coalescing_panda/canvas_batches/_canvas_batch_flash.html.haml +1 -1
- data/config/routes.rb +3 -1
- data/db/migrate/20150602205257_add_option_to_canvas_batches.rb +5 -0
- data/lib/coalescing_panda/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 22c6676c9d9e90786efa807220f76ff9b2eec393
|
4
|
+
data.tar.gz: 035edddad586577ecb9ec49660559f5d09818004
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0c4e3fc9c21ca02ea50ef51fc5672f4177372e594572134f24c1a978699876973610648522364acde75734cf2f6bffa443c17ae1725e1568ab67376803c6efbe
|
7
|
+
data.tar.gz: cf8af365aebf0a52ad293840bdbb9af05322f882a6e7c87e7a2633c3ee509fbdb5bb36e29bb954067f40e5f59ecdc20875c6bb632c63e33ea0df757acf7224f2
|
@@ -23,6 +23,8 @@ window.CoalescingPanda.CanvasBatchProgress = class CanvasBatchProgress
|
|
23
23
|
else if batch && batch.status == 'Error'
|
24
24
|
clearIntervalAndBatch(data, batch)
|
25
25
|
errorCallback() if errorCallback != undefined
|
26
|
+
else if batch && batch.status == "Canceled"
|
27
|
+
clearIntervalAndBatch(data, batch)
|
26
28
|
|
27
29
|
error: (message) ->
|
28
30
|
$('#batch-progress').html('Batch status request failed')
|
@@ -7,6 +7,16 @@ module CoalescingPanda
|
|
7
7
|
render @batch
|
8
8
|
end
|
9
9
|
|
10
|
+
def retrigger
|
11
|
+
@batch = CanvasBatch.find(params[:id])
|
12
|
+
@batch.status = 'Queued'
|
13
|
+
@batch.save
|
14
|
+
worker = CoalescingPanda::Workers::CourseMiner.new(@batch.context, @batch.options)
|
15
|
+
session[:canvas_batch_id] = worker.batch.id
|
16
|
+
worker.start(true)
|
17
|
+
redirect_to :back
|
18
|
+
end
|
19
|
+
|
10
20
|
def clear_batch_session
|
11
21
|
session[:canvas_batch_id] = nil
|
12
22
|
render nothing: true
|
@@ -23,16 +23,22 @@ class CoalescingPanda::Workers::CourseMiner
|
|
23
23
|
if batch.present? and RUNNING_STATUSES.include?(batch.status)
|
24
24
|
batch
|
25
25
|
else
|
26
|
-
account.canvas_batches.create(context: course, status: "Queued")
|
26
|
+
batch = account.canvas_batches.create(context: course, status: "Queued")
|
27
27
|
end
|
28
|
+
batch.update_attributes(options: options)
|
29
|
+
batch
|
28
30
|
end
|
29
31
|
|
30
32
|
def api_client
|
31
33
|
@api_client ||= Bearcat::Client.new(prefix: account.settings[:base_url], token: account.settings[:account_admin_api_token])
|
32
34
|
end
|
33
35
|
|
34
|
-
def start
|
35
|
-
|
36
|
+
def start(forced = false)
|
37
|
+
unless forced
|
38
|
+
return unless batch.status == 'Queued' # don't start if there is already a running job
|
39
|
+
return unless should_download?
|
40
|
+
end
|
41
|
+
|
36
42
|
begin
|
37
43
|
batch.update_attributes(status: "Started", percent_complete: 0)
|
38
44
|
index = 1
|
@@ -50,6 +56,14 @@ class CoalescingPanda::Workers::CourseMiner
|
|
50
56
|
end
|
51
57
|
handle_asynchronously :start
|
52
58
|
|
59
|
+
def should_download?
|
60
|
+
return true unless account.settings[:canvas_download_interval].present?
|
61
|
+
return true unless last_completed_batch = account.canvas_batches.where(context: course, status: 'Completed').order('updated_at ASC').first
|
62
|
+
should_download = last_completed_batch.updated_at < Time.zone.now - account.settings[:canvas_download_interval].minutes
|
63
|
+
batch.update_attributes(status: 'Canceled') unless should_download
|
64
|
+
should_download
|
65
|
+
end
|
66
|
+
|
53
67
|
def process_api_data(key)
|
54
68
|
case key
|
55
69
|
when :assignment_groups
|
@@ -1,20 +1,30 @@
|
|
1
1
|
#batch-info{data: {batch: @batch.to_json}}
|
2
|
-
-if @batch.status == "Queued"
|
3
|
-
%
|
2
|
+
- if @batch.status == "Queued"
|
3
|
+
%span.batch-message-queued Data is queued for download from Canvas.
|
4
4
|
|
5
|
-
-if @batch.status == "Completed"
|
5
|
+
- if @batch.status == "Completed"
|
6
6
|
.alert.alert-success
|
7
7
|
%button.close{"data-dismiss" => "alert", :type => "button"} ×
|
8
8
|
%span.batch-message-completed
|
9
9
|
Data successfully downloaded from Canvas.
|
10
10
|
|
11
|
-
-if @batch.status == "Started"
|
12
|
-
%
|
11
|
+
- if @batch.status == "Started"
|
12
|
+
%span.batch-message-started Downloading data from Canvas
|
13
13
|
.progress
|
14
14
|
.progress-bar{"aria-valuemax" => "100", "aria-valuemin" => "0", "aria-valuenow" => "#{@batch.percent_complete}", :role => "progressbar", :style => "width: #{@batch.percent_complete}%;"}
|
15
15
|
|
16
|
-
-if @batch.status == "Error"
|
16
|
+
- if @batch.status == "Error"
|
17
17
|
.alert.alert-block.alert-error
|
18
18
|
%button.close{"data-dismiss" => "alert", :type => "button"} ×
|
19
|
-
%
|
20
|
-
= @batch.message
|
19
|
+
%span.batch-message-error Data failed to download from Canvas
|
20
|
+
= @batch.message
|
21
|
+
|
22
|
+
- if @batch.status == "Canceled"
|
23
|
+
.alert.alert-block.alert-info
|
24
|
+
%button.close{"data-dismiss" => "alert", :type => "button"} ×
|
25
|
+
%span.batch-message-retrigger
|
26
|
+
Canvas data last downloaded
|
27
|
+
= @batch.updated_at
|
28
|
+
.pull-right
|
29
|
+
= link_to "Retrigger", retrigger_canvas_batch_path(@batch), method: :post, class: "btn btn-default"
|
30
|
+
.clearfix
|
@@ -1,4 +1,4 @@
|
|
1
1
|
- if current_batch.present?
|
2
2
|
- path = CoalescingPanda::Engine.routes.url_helpers.canvas_batch_path(current_batch)
|
3
|
-
-clear_path = CoalescingPanda::Engine.routes.url_helpers.clear_batch_session_path
|
3
|
+
- clear_path = CoalescingPanda::Engine.routes.url_helpers.clear_batch_session_path
|
4
4
|
#batch-progress{data: {batch: current_batch.try(:to_json), url: path, clear_path: clear_path} }
|
data/config/routes.rb
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
CoalescingPanda::Engine.routes.draw do
|
2
|
-
resources :canvas_batches, only: [:show]
|
2
|
+
resources :canvas_batches, only: [:show, :update] do
|
3
|
+
post :retrigger, on: :member
|
4
|
+
end
|
3
5
|
post '/canvas_batches/clear_batch_session', as: :clear_batch_session
|
4
6
|
|
5
7
|
get '/oauth2/redirect' => 'oauth2#redirect'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: coalescing_panda
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.1.
|
4
|
+
version: 4.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nathan Mills
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2015-06-
|
13
|
+
date: 2015-06-03 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rails
|
@@ -377,6 +377,7 @@ files:
|
|
377
377
|
- db/migrate/20150506183335_create_coalescing_panda_assignment_groups.rb
|
378
378
|
- db/migrate/20150506192717_add_assignment_group_id_to_assignments.rb
|
379
379
|
- db/migrate/20150526144713_add_account_to_canvas_batches.rb
|
380
|
+
- db/migrate/20150602205257_add_option_to_canvas_batches.rb
|
380
381
|
- lib/coalescing_panda.rb
|
381
382
|
- lib/coalescing_panda/controller_helpers.rb
|
382
383
|
- lib/coalescing_panda/engine.rb
|