Your Community is getting an upgrade!
Read about our partnership with Higher Logic and how we will build the next generation of the Instructure Community.
Found this content helpful? Log in or sign up to leave a like!
I need a list of how long each student takes to complete a quiz. Students start at different times, so submission times (which are easily downloaded) are not sufficient.
My class is large, so opening each student's quiz log, typing the start time into a spreadsheet, and computing the difference between start time and submission time is not a viable solution.
How can I obtain a list of all students' individual quiz durations (or start times)?
Thanks in advance,
Dave
Are you familiar with the Canvas API? The start time is a property of the quiz submissions there: https://canvas.instructure.com/doc/api/quiz_submissions.html
Alternatively, if you prefer to deal with HTML, if you go to the Moderate Quiz page and choose to "inspect" any student's line in the browser, there is a "data-started-at" property for each student, which can more easily be captured. A tampermonkey script can also probably make that visible to the user.
I asked chatgpt to create this script, and it works for me. Edit the @match part to match your university's url.
// ==UserScript==
// @Name Append Data Columns for data-started-at and data-end-at
// @namespace http://tampermonkey.net/
// @version 0.2
// @description Appends new columns with "data-started-at" and "data-end-at" values for each row, and adds header cells for them.
// @author Your Name
// @match https://canvas.[insert university].edu/courses/*/quizzes/*/moderate
// @grant none
// ==/UserScript==
(function() {
'use strict';
// Adds header cells to tables that contain rows with our data attributes.
function addHeaderColumns() {
const tables = document.querySelectorAll('table');
tables.forEach(table => {
// Try to get the header row from <thead>
let headerRow = table.querySelector('thead tr');
// If no <thead>, try the first row of the table.
if (!headerRow) {
headerRow = table.querySelector('tr');
if (!headerRow) return; // skip if no row found
}
// Avoid duplicate headers by checking for a custom class
if (!headerRow.querySelector('.tm-started-at-header')) {
const thStarted = document.createElement('th');
thStarted.textContent = 'Started At';
thStarted.classList.add('tm-started-at-header');
headerRow.appendChild(thStarted);
}
if (!headerRow.querySelector('.tm-end-at-header')) {
const thEnded = document.createElement('th');
thEnded.textContent = 'End At';
thEnded.classList.add('tm-end-at-header');
headerRow.appendChild(thEnded);
}
});
}
// Appends new cells with data attribute values to each table row.
function appendDataColumns() {
// Select rows that have either attribute (or both)
const rows = document.querySelectorAll('tr[data-started-at], tr[data-end-at]');
rows.forEach(row => {
// For data-started-at
const startedAtValue = row.getAttribute('data-started-at') || '';
const newCellStarted = document.createElement('td');
newCellStarted.textContent = startedAtValue;
row.appendChild(newCellStarted);
// For data-end-at
const endAtValue = row.getAttribute('data-end-at') || '';
const newCellEnded = document.createElement('td');
newCellEnded.textContent = endAtValue;
row.appendChild(newCellEnded);
});
}
// Process all tables: add headers and append cells.
function processTables() {
addHeaderColumns();
appendDataColumns();
}
// Wait until the DOM is fully loaded.
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', processTables);
} else {
processTables();
}
})();
Just went back to check the numbers, the start time above seems to be correct, but the end time above seems to just be the the start time + time limit, or the deadline.
So I think you'd have to get the end time somewhere else (such as by downloading the student analysis report).
I haven't tested what start time is used when a student has multiple attempts.
To interact with Panda Bot, our automated chatbot, you need to sign up or log in:
Sign InTo interact with Panda Bot, our automated chatbot, you need to sign up or log in:
Sign In