-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Description
Issue Type
- [X ] Bug Report
- [X ] Feature Request
- Question/Support
Current Behavior
- Right now the package seems to allow for downloading student results using
get_assignment_submissions, but when I use it an error appears stating I do not have the rights, although I do. When looking further into the function it seems that, at least in my canvas system, the following path does not exist/students/submissions/. - Also, inspired by Jon Vik's work I was planning on writing a
get_course_gradebookfunction that would search for both regular assignments and quiz results in the course and bundle these into onedata.frame, hopefully to later on uploading it after processing adjustments. In that case both quiz and assignment results should be sought in the system.
Suggestion
I would suggest to add a function similar to this one:
get_submissions <- function (canvas, course_id, type, id, per_page = 100)
{
if (!type %in% c("quizzes", "assignments"))
stop("type must be 'quizzes' or 'assignments'")
url <- paste0(canvas$base_url, "/api/v1/courses/", course_id, "/",
type, "/", id, "/submissions?per_page=", per_page)
response <- httr::GET(url, httr::add_headers(Authorization = paste("Bearer",
canvas$api_key)))
if (httr::status_code(response) != 200) {
stop("Failed to retrieve assignment submissions. Please check your authentication and API endpoint.")
}
if(type == "quizzes") {
submissions <- httr::content(response, "text", encoding = "UTF-8") %>%
jsonlite::fromJSON(flatten = TRUE) %>% .[[1]]
} else {
submissions <- httr::content(response, "text", encoding = "UTF-8") %>%
jsonlite::fromJSON(flatten = TRUE)
}
return(submissions)
}
Here:
typewould be either "quizzes" or "assignments".idwould be either a quiz_id or assigenment_id, depending on type.
Not sure
Not sure if that would be something that could be added because there is already a get_assignment_submissions function, and possibly you would prefer different functions for assignments and quizzes.
Copilot
Metadata
Metadata
Assignees
Labels
No labels