add reset attempts all button click handler, increase polling interval, add slick grid refresh
This commit is contained in:
@@ -9,6 +9,8 @@ std_ajax_err = -> window.InstructorDashboard.util.std_ajax_err.apply this, argum
|
||||
# Analytics Section
|
||||
class Analytics
|
||||
constructor: (@$section) ->
|
||||
@$section.data 'wrapper', @
|
||||
|
||||
# gather elements
|
||||
@$display = @$section.find '.distribution-display'
|
||||
@$display_text = @$display.find '.distribution-display-text'
|
||||
@@ -99,7 +101,6 @@ class Analytics
|
||||
console.warn("unable to show distribution #{feature_res.type}")
|
||||
@$display_text.text 'Unavailable Metric Display\n' + JSON.stringify(feature_res)
|
||||
|
||||
|
||||
# fetch distribution data from server.
|
||||
# `handler` can be either a callback for success
|
||||
# or a mapping e.g. {success: ->, error: ->, complete: ->}
|
||||
@@ -116,6 +117,16 @@ class Analytics
|
||||
|
||||
$.ajax settings
|
||||
|
||||
# slickgrid's layout collapses when rendered
|
||||
# in an invisible div. use this method to reload
|
||||
# the AuthList widget
|
||||
refresh: ->
|
||||
@on_selector_change()
|
||||
|
||||
# handler for when the section title is clicked.
|
||||
onClickTitle: ->
|
||||
@refresh()
|
||||
|
||||
|
||||
# export for use
|
||||
# create parent namespaces if they do not already exist.
|
||||
|
||||
@@ -214,6 +214,19 @@ class StudentAdmin
|
||||
success: @clear_errors_then -> console.log 'started reset attempts task'
|
||||
error: std_ajax_err => @$request_response_error_all.text "Error starting a task to reset attempts for all students on this problem."
|
||||
|
||||
# start task to rescore problem for all students
|
||||
@$btn_reset_attempts_all.click =>
|
||||
send_data =
|
||||
all_students: true
|
||||
problem_to_reset: @$field_problem_select_all.val()
|
||||
|
||||
$.ajax
|
||||
dataType: 'json'
|
||||
url: @$btn_reset_attempts_all.data 'endpoint'
|
||||
data: send_data
|
||||
success: @clear_errors_then -> console.log 'started reset attempts task'
|
||||
error: std_ajax_err => @$request_response_error_all.text "Error starting a task to reset attempts on this problem for all students."
|
||||
|
||||
# start task to rescore problem for all students
|
||||
@$btn_rescore_problem_all.click =>
|
||||
send_data =
|
||||
@@ -255,7 +268,8 @@ class StudentAdmin
|
||||
start_refresh_running_task_poll_loop: ->
|
||||
@reload_running_tasks_list()
|
||||
if @$section.hasClass 'active-section'
|
||||
plantTimeout 5000, => @start_refresh_running_task_poll_loop()
|
||||
# poll every 20 seconds
|
||||
plantTimeout 20000, => @start_refresh_running_task_poll_loop()
|
||||
|
||||
# wraps a function, but first clear the error displays
|
||||
clear_errors_then: (cb) ->
|
||||
|
||||
Reference in New Issue
Block a user