Make student profile CSV download a background task, add cohort column
This commit is contained in:
@@ -26,11 +26,11 @@ class DataDownload
|
||||
# response areas
|
||||
@$download = @$section.find '.data-download-container'
|
||||
@$download_display_text = @$download.find '.data-display-text'
|
||||
@$download_display_table = @$download.find '.data-display-table'
|
||||
@$download_request_response_error = @$download.find '.request-response-error'
|
||||
@$grades = @$section.find '.grades-download-container'
|
||||
@$grades_request_response = @$grades.find '.request-response'
|
||||
@$grades_request_response_error = @$grades.find '.request-response-error'
|
||||
@$reports = @$section.find '.reports-download-container'
|
||||
@$download_display_table = @$reports.find '.data-display-table'
|
||||
@$reports_request_response = @$reports.find '.request-response'
|
||||
@$reports_request_response_error = @$reports.find '.request-response-error'
|
||||
|
||||
@report_downloads = new ReportDownloads(@$section)
|
||||
@instructor_tasks = new (PendingInstructorTasks()) @$section
|
||||
@@ -45,11 +45,22 @@ class DataDownload
|
||||
# this handler binds to both the download
|
||||
# and the csv button
|
||||
@$list_studs_csv_btn.click (e) =>
|
||||
@clear_display()
|
||||
|
||||
url = @$list_studs_csv_btn.data 'endpoint'
|
||||
# handle csv special case
|
||||
# redirect the document to the csv file.
|
||||
url += '/csv'
|
||||
location.href = url
|
||||
|
||||
$.ajax
|
||||
dataType: 'json'
|
||||
url: url
|
||||
error: (std_ajax_err) =>
|
||||
@$reports_request_response_error.text gettext("Error generating student profile information. Please try again.")
|
||||
$(".msg-error").css({"display":"block"})
|
||||
success: (data) =>
|
||||
@$reports_request_response.text data['status']
|
||||
$(".msg-confirm").css({"display":"block"})
|
||||
|
||||
@$list_studs_btn.click (e) =>
|
||||
url = @$list_studs_btn.data 'endpoint'
|
||||
@@ -62,7 +73,7 @@ class DataDownload
|
||||
$.ajax
|
||||
dataType: 'json'
|
||||
url: url
|
||||
error: std_ajax_err =>
|
||||
error: (std_ajax_err) =>
|
||||
@clear_display()
|
||||
@$download_request_response_error.text gettext("Error getting student list.")
|
||||
success: (data) =>
|
||||
@@ -89,7 +100,7 @@ class DataDownload
|
||||
$.ajax
|
||||
dataType: 'json'
|
||||
url: url
|
||||
error: std_ajax_err =>
|
||||
error: (std_ajax_err) =>
|
||||
@clear_display()
|
||||
@$download_request_response_error.text gettext("Error retrieving grading configuration.")
|
||||
success: (data) =>
|
||||
@@ -105,11 +116,11 @@ class DataDownload
|
||||
$.ajax
|
||||
dataType: 'json'
|
||||
url: url
|
||||
error: std_ajax_err =>
|
||||
@$grades_request_response_error.text gettext("Error generating grades. Please try again.")
|
||||
error: (std_ajax_err) =>
|
||||
@$reports_request_response_error.text gettext("Error generating grades. Please try again.")
|
||||
$(".msg-error").css({"display":"block"})
|
||||
success: (data) =>
|
||||
@$grades_request_response.text data['status']
|
||||
@$reports_request_response.text data['status']
|
||||
$(".msg-confirm").css({"display":"block"})
|
||||
|
||||
# handler for when the section title is clicked.
|
||||
@@ -129,8 +140,8 @@ class DataDownload
|
||||
@$download_display_text.empty()
|
||||
@$download_display_table.empty()
|
||||
@$download_request_response_error.empty()
|
||||
@$grades_request_response.empty()
|
||||
@$grades_request_response_error.empty()
|
||||
@$reports_request_response.empty()
|
||||
@$reports_request_response_error.empty()
|
||||
# Clear any CSS styling from the request-response areas
|
||||
$(".msg-confirm").css({"display":"none"})
|
||||
$(".msg-error").css({"display":"none"})
|
||||
@@ -157,7 +168,7 @@ class ReportDownloads
|
||||
@create_report_downloads_table data.downloads
|
||||
else
|
||||
console.log "No reports ready for download"
|
||||
error: std_ajax_err => console.error "Error finding report downloads"
|
||||
error: (std_ajax_err) => console.error "Error finding report downloads"
|
||||
|
||||
create_report_downloads_table: (report_downloads_data) ->
|
||||
@$report_downloads_table.empty()
|
||||
|
||||
Reference in New Issue
Block a user