Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save trycf/9cc2aa24fd6a58238d1cfe019d3fb1da to your computer and use it in GitHub Desktop.
Save trycf/9cc2aa24fd6a58238d1cfe019d3fb1da to your computer and use it in GitHub Desktop.
TryCF Gist
<cftry>
<cfapplication action="update" nullSupport = true>
<cfscript>
TheJSON =
{
"id": 499,
"created_at": "2022-06-29T23:02:07Z",
"started_at": "2022-06-29T23:03:47Z",
"ended_at": "2022-06-29T23:24:06Z",
"updated_at": "2022-06-29T23:24:07Z",
"progress": 100,
"workflow_state": "imported_with_messages",
"data": {
"import_type": "instructure_csv",
"downloadable_attachment_ids": [
1293161,
1293162,
1293163,
1293164,
1293165,
1293166,
1293167,
1293168
],
"supplied_batches": [
"course",
"section",
"xlist",
"user",
"enrollment"
],
"counts": {
"change_sis_ids": 0,
"accounts": 0,
"terms": 0,
"abstract_courses": 0,
"courses": 3643,
"sections": 3643,
"xlists": 89,
"users": 66109,
"logins": 0,
"enrollments": 66975,
"admins": 0,
"group_categories": 0,
"groups": 0,
"group_memberships": 0,
"grade_publishing_results": 0,
"user_observers": 0,
"error_count": 0,
"warning_count": 27
},
"running_immediately": false,
"completed_importers": [
"course",
"section",
"xlist",
"user",
"enrollment"
],
"statistics": {
"total_state_changes": 121,
"Account": {
"created": 0,
"restored": 0,
"deleted": 0
},
"EnrollmentTerm": {
"created": 0,
"restored": 0,
"deleted": 0
},
"AbstractCourse": {
"created": 0,
"restored": 0,
"deleted": 0
},
"Course": {
"created": 1,
"restored": 0,
"concluded": 0,
"deleted": 0
},
"CourseSection": {
"created": 0,
"restored": 0,
"deleted": 0
},
"GroupCategory": {
"created": 0,
"restored": 0,
"deleted": 0
},
"Group": {
"created": 0,
"restored": 0,
"deleted": 0
},
"Pseudonym": {
"created": 1,
"restored": 0,
"deleted": 0
},
"CommunicationChannel": {
"created": 1,
"restored": 12,
"deleted": 0
},
"Enrollment": {
"created": 4,
"restored": 0,
"concluded": 0,
"deactivated": 102,
"deleted": 0
},
"GroupMembership": {
"created": 0,
"restored": 0,
"deleted": 0
},
"UserObserver": {
"created": 0,
"restored": 0,
"deleted": 0
},
"AccountUser": {
"created": 0,
"restored": 0,
"deleted": 0
}
}
},
"batch_mode": null,
"batch_mode_term_id": null,
"multi_term_batch_mode": null,
"override_sis_stickiness": null,
"add_sis_stickiness": null,
"update_sis_id_if_login_claimed": false,
"clear_sis_stickiness": null,
"diffing_data_set_identifier": null,
"diffing_remaster": null,
"diffed_against_import_id": null,
"diffing_drop_status": null,
"skip_deletes": false,
"change_threshold": null,
"diff_row_count_threshold": null,
"processing_warnings": [
[
"users.csv",
"An existing Canvas user with the SIS ID 013239436 has already claimed 013239592's user_id requested login information, skipping"
],
[
"assignments.csv",
"User not found for enrollment (User ID: 150008658, Course ID: , Section ID: 2229-POSC-343-01-2889-1)"
],
[
"assignments.csv",
"User not found for enrollment (User ID: 150008658, Course ID: , Section ID: 2229-POSC-345-01-2891-1)"
],
[
"assignments.csv",
"User not found for enrollment (User ID: 150008658, Course ID: , Section ID: 2229-POSC-380-01-2896-1)"
],
[
"assignments.csv",
"User not found for enrollment (User ID: 004616192, Course ID: , Section ID: 2229-TED-474-01-1190-1)"
],
[
"assignments.csv",
"User not found for enrollment (User ID: 150008255, Course ID: , Section ID: 2229-ENVT-330-01-2299-1)"
],
[
"assignments.csv",
"User not found for enrollment (User ID: 150008255, Course ID: , Section ID: 2229-GEOG-120-01-2302-1)"
],
[
"assignments.csv",
"User not found for enrollment (User ID: 150008255, Course ID: , Section ID: 2229-GEOG-455-01-2300-1)"
],
[
"assignments.csv",
"User not found for enrollment (User ID: 150008268, Course ID: , Section ID: 2229-HIST-201-01-1656-1)"
],
[
"assignments.csv",
"User not found for enrollment (User ID: 150008268, Course ID: , Section ID: 2229-HIST-405-01-1674-1)"
],
[
"assignments.csv",
"User not found for enrollment (User ID: 150008268, Course ID: , Section ID: 2229-HIST-600-01-1684-1)"
],
[
"enrollments2229.csv",
"User not found for enrollment (User ID: 201567670, Course ID: , Section ID: 2229-EXTX-560-01HB-3801-DY1)"
],
[
"enrollments2227.csv",
"User not found for enrollment (User ID: 201365897, Course ID: , Section ID: 2227-ACCT-802C-03JV-1482-SSD)"
],
[
"enrollments2227.csv",
"User not found for enrollment (User ID: 201559376, Course ID: , Section ID: 2227-KIN-850-01HA-1737-DY1)"
],
[
"enrollments2227.csv",
"User not found for enrollment (User ID: 201559376, Course ID: , Section ID: 2227-KIN-851-01HA-1738-DY1)"
],
[
"enrollments2227.csv",
"User not found for enrollment (User ID: 201559376, Course ID: , Section ID: 2227-KIN-853-01HA-1740-DY1)"
],
[
"enrollments2227.csv",
"User not found for enrollment (User ID: 201559376, Course ID: , Section ID: 2227-KIN-854-01HA-1741-DY1)"
],
[
"enrollments2227.csv",
"User not found for enrollment (User ID: 201559376, Course ID: , Section ID: 2227-KIN-856-01HA-1743-DY1)"
],
[
"enrollments2227.csv",
"User not found for enrollment (User ID: 201567683, Course ID: , Section ID: 2227-TED-802C-01HA-1809-DY1)"
],
[
"enrollments2227.csv",
"User not found for enrollment (User ID: 201567683, Course ID: , Section ID: 2227-TED-841C-01HA-1810-DY1)"
],
[
"enrollments2227.csv",
"User not found for enrollment (User ID: 201567683, Course ID: , Section ID: 2227-TED-842C-1HA-1811-DY1)"
],
[
"enrollments2227.csv",
"User not found for enrollment (User ID: 201567683, Course ID: , Section ID: 2227-TED-843C-01HA-1812-DY1)"
],
[
"enrollments2227.csv",
"User not found for enrollment (User ID: 201567696, Course ID: , Section ID: 2227-TED-843C-01HA-1812-DY1)"
],
[
"enrollments2227.csv",
"User not found for enrollment (User ID: 201567683, Course ID: , Section ID: 2227-TED-844C-01HA-1814-DY1)"
],
[
"and 3 more warnings that were not included",
"Download the error file to see all warnings."
]
],
"errors_attachment": {
"id": 1293294,
"uuid": "O12B4oNCToE6o5Yt4qAF9QhEyhYlKu7t2n5h78Gq",
"folder_id": null,
"display_name": "sis_errors_attachment_499.csv",
"filename": "211450000000000499_processing_warnings_and_errors2022-06-29+232407+UTC20220629-10640-1dq5pso.csv",
"upload_status": "success",
"content-type": "csv",
"url": "site",
"size": 3638,
"created_at": "2022-06-29T23:24:07Z",
"updated_at": "2022-06-29T23:24:07Z",
"unlock_at": null,
"locked": false,
"hidden": false,
"lock_at": null,
"hidden_for_user": false,
"thumbnail_url": null,
"modified_at": "2022-06-29T23:24:07Z",
"mime_class": "file",
"media_entry_id": null,
"locked_for_user": false
},
"user": {
"id": 175,
"name": "Dan Legate",
"created_at": "2022-01-19T13:21:38-08:00",
"sortable_name": "Legate, Dan",
"short_name": "Dan Legate",
"sis_user_id": "000022603",
"integration_id": null,
"sis_import_id": 499,
"login_id": "dx7668"
},
"csv_attachments": [
{
"id": 1293168,
"uuid": "qgoQmze0dSP8yPj2MddkXtUTATQFSpiY1PQ7oBoX",
"folder_id": null,
"display_name": "courses2229.csv",
"filename": "courses2229.csv",
"upload_status": "success",
"content-type": "text/csv",
"url": "site",
"size": 383165,
"created_at": "2022-06-29T23:03:50Z",
"updated_at": "2022-06-29T23:03:50Z",
"unlock_at": null,
"locked": false,
"hidden": false,
"lock_at": null,
"hidden_for_user": false,
"thumbnail_url": null,
"modified_at": "2022-06-29T23:03:50Z",
"mime_class": "file",
"media_entry_id": null,
"locked_for_user": false
},
{
"id": 1293166,
"uuid": "tXfDl8Gb8NeLiwE03QlrUmxnCtnBKu5vAdDj2WU7",
"folder_id": null,
"display_name": "courses2227.csv",
"filename": "courses2227.csv",
"upload_status": "success",
"content-type": "text/csv",
"url": "site",
"size": 112425,
"created_at": "2022-06-29T23:03:49Z",
"updated_at": "2022-06-29T23:03:49Z",
"unlock_at": null,
"locked": false,
"hidden": false,
"lock_at": null,
"hidden_for_user": false,
"thumbnail_url": null,
"modified_at": "2022-06-29T23:03:49Z",
"mime_class": "file",
"media_entry_id": null,
"locked_for_user": false
},
{
"id": 1293167,
"uuid": "EL30yHiz4VOFMktXc18isi7qBk4vh9DUYaUOKZcr",
"folder_id": null,
"display_name": "enrollments2227.csv",
"filename": "enrollments2227.csv",
"upload_status": "success",
"content-type": "text/csv",
"url": "site",
"size": 800855,
"created_at": "2022-06-29T23:03:50Z",
"updated_at": "2022-06-29T23:03:50Z",
"unlock_at": null,
"locked": false,
"hidden": false,
"lock_at": null,
"hidden_for_user": false,
"thumbnail_url": null,
"modified_at": "2022-06-29T23:03:50Z",
"mime_class": "file",
"media_entry_id": null,
"locked_for_user": false
},
{
"id": 1293162,
"uuid": "NrV3dfBHX35YBZhw6NaPBHsFnfrS9ZZUk4JTevb1",
"folder_id": null,
"display_name": "assignments.csv",
"filename": "assignments.csv",
"upload_status": "success",
"content-type": "text/csv",
"url": "site",
"size": 192244,
"created_at": "2022-06-29T23:03:48Z",
"updated_at": "2022-06-29T23:03:48Z",
"unlock_at": null,
"locked": false,
"hidden": false,
"lock_at": null,
"hidden_for_user": false,
"thumbnail_url": null,
"modified_at": "2022-06-29T23:03:48Z",
"mime_class": "file",
"media_entry_id": null,
"locked_for_user": false
},
{
"id": 1293161,
"uuid": "5gMV74wYat4jkz9cOlHYI4fATggxqH0PcGTb4vuy",
"folder_id": null,
"display_name": "xlists.csv",
"filename": "xlists.csv",
"upload_status": "success",
"content-type": "text/csv",
"url": "site",
"size": 5683,
"created_at": "2022-06-29T23:03:48Z",
"updated_at": "2022-06-29T23:03:48Z",
"unlock_at": null,
"locked": false,
"hidden": false,
"lock_at": null,
"hidden_for_user": false,
"thumbnail_url": null,
"modified_at": "2022-06-29T23:03:48Z",
"mime_class": "file",
"media_entry_id": null,
"locked_for_user": false
},
{
"id": 1293163,
"uuid": "pOwJn08JzTWDaQDK3hsXCJtTUwHXfvOkDd7PMHfY",
"folder_id": null,
"display_name": "users.csv",
"filename": "users.csv",
"upload_status": "success",
"content-type": "text/csv",
"url": "site",
"size": 5788661,
"created_at": "2022-06-29T23:03:49Z",
"updated_at": "2022-06-29T23:03:49Z",
"unlock_at": null,
"locked": false,
"hidden": false,
"lock_at": null,
"hidden_for_user": false,
"thumbnail_url": null,
"modified_at": "2022-06-29T23:03:49Z",
"mime_class": "file",
"media_entry_id": null,
"locked_for_user": false
},
{
"id": 1293164,
"uuid": "R3oTHwNYgXn0XV9tbQmO2flRZd35CiVk0SfnwdOp",
"folder_id": null,
"display_name": "enrollments2229.csv",
"filename": "enrollments2229.csv",
"upload_status": "success",
"content-type": "text/csv",
"url": "site",
"size": 3500440,
"created_at": "2022-06-29T23:03:49Z",
"updated_at": "2022-06-29T23:03:49Z",
"unlock_at": null,
"locked": false,
"hidden": false,
"lock_at": null,
"hidden_for_user": false,
"thumbnail_url": null,
"modified_at": "2022-06-29T23:03:49Z",
"mime_class": "file",
"media_entry_id": null,
"locked_for_user": false
},
{
"id": 1293165,
"uuid": "jfKZmLH5AMJ4GshvnPM56rL9Bb4iDKG9xaA8DnJM",
"folder_id": null,
"display_name": "sections.csv",
"filename": "sections.csv",
"upload_status": "success",
"content-type": "text/csv",
"url": "site",
"size": 383991,
"created_at": "2022-06-29T23:03:49Z",
"updated_at": "2022-06-29T23:03:49Z",
"unlock_at": null,
"locked": false,
"hidden": false,
"lock_at": null,
"hidden_for_user": false,
"thumbnail_url": null,
"modified_at": "2022-06-29T23:03:49Z",
"mime_class": "file",
"media_entry_id": null,
"locked_for_user": false
}
]
}
;
//dump(TheJSON);
tcount = 0
NonZeroCounts = StructReduce(TheJSON.data.counts, function(result, key, value) {
if (value > 0) {
result['data'][key] = value;
if (key DOES NOT CONTAIN "warning" && key DOES NOT CONTAIN "error") {
result['tcount2'] += value;
tcount += value;
}
result['tcount3'] += value;
}
return result;
}, {data:{},tcount2: 0, tcount3: 0}) ;
dump(var=tcount, label='tcount');
dump(NonZeroCounts);
</cfscript>
<cffinally>
<cfapplication action="update" nullSupport = false>
</cffinally>
</cftry>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment