Identify if an assignment counts towards final grade from Canvas Data

Jump to solution
ryucali
Community Explorer

I want to identify from Canvas Data if "do not count this assignment towards the final grade" is checked for any assignment, but I don't find this info from assignment_dim/fact tables. Is there anyway to get this information from the data?

Actually this question applies to some other checkboxes in assignment/quiz/module setup stage as well, such as "Show one question at a time" in a quiz setup.

Labels (4)
0 Likes
1 Solution
James
Community Champion

@ryucali 

The current version of Canvas Data does not include any way to infer the information.

The API approach is not efficient, but it is all that you currently have to work with until Canvas Data 2 comes out. Live Events won't help in this case anyway.

The good news is that you would only need to download the assignment information once for completed courses since the information wouldn't be changing. You may want to periodically refresh the status for current courses.

You can use GraphQL to quickly get the omitFromFinalGrade property without having to download all of the other information that would come with the Assignments API. You would need to repeat this once for each course using the ID for the course.

query assignmentQuery {
  course(id: "3119582") {
    assignmentsConnection {
      nodes {
        _id
        omitFromFinalGrade
      }
    }
  }
}

  

You can also run the report for all classes within a subaccount at one time, but it will likely timeout (especially if you run it for the root account) and force you to use pagination. This query returns information for the first 500 courses (use your account ID) and pagination information needed to continue.

query allAssignmentsQuery {
  account(id: "97773") {
    id
    coursesConnection(first: 500) {
      nodes {
        _id
        assignmentsConnection {
          nodes {
            _id
            omitFromFinalGrade
          }
        }
      }
      pageInfo {
        endCursor
        hasNextPage
      }
    }
  }
}

 

This includes information for courses that are deleted as there is no way to filter on Canvas' implementation of GraphQL. However, it took me under 10 seconds to fetch the results for the first 500 courses. It took me 35 seconds to get the first 1000 courses and I thought Canvas was going to complain and fail, so I cut the number back. The first query -- for a single course -- took under 400 ms. Your speeds will likely vary.

For additional requests, use the endCursor that is returned to make the next request. For example, my hasNextPage was true and my endCursor from the previous request was "NTAw". So in my second request, I specified that on the coursesConnection line.

    coursesConnection(first: 500, after: "NTAw") {

 

View solution in original post