Commit a9749f38 by Miles Steele

add reset attempts all button click handler, increase polling interval, add slick grid refresh

parent b44e8fe8
......@@ -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.
......
......@@ -215,6 +215,19 @@ class StudentAdmin
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 =
all_students: true
......@@ -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) ->
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment