Removing Missing and Late Labels

James
Community Champion
81
31359

In GET THE RED INK OUT OF MY GRADEBOOK. The Sequel., laurakgibbs  makes a passionate plea to remove the missing and late labels that come along with the new gradebook.   @kona ‌ had me take a look at the issue and I determined that there was something that could be done through the API, but I didn't have time to look into it right then. She created a feature request for someone to help out: Macro help with the new Gradebook! 

I still don't have time to look at it, but I did anyway, and this blog post is to make the code available to people. This code does not have a fancy interface. It doesn't add any buttons to Canvas. I thought about it, but the way discussions would be handled would have to be completely different from the way that quizzes and assignments would be handled, and I hope that this is a short-term work-around, and I really need to get ready for the semester to begin, but I know that people wanted this.

Background

The new gradebook doesn't have the option to disable the missing or late labels for students. You can go through and manually change the late policy status to "none" and it will remove the labels.

Laura (forgive me if I get this wrong) teaches in a way not supported by Canvas and allows students to choose which assignments to complete. She feels the assignments that the students don't complete aren't missing, they were optional and there are too many for any student to attempt to do them all. Yet they are faced with a sea of red "missing" labels for assignments they never really had. Some people feel that if you tell the students "that's just the way Canvas does things and you should ignore it for my class," they will. However, Laura feels it's harmful to the students. She has 200 assignments for 90 students, and is so passionate about this that she was going to go through all 18,000 assignments and manually set the status to "none" to get rid of this.

I've made a name out of automating repetitive tasks, so Kona asked me about this. The script that you're getting automates that process.

What does it do?

It removes the missing or late labels by setting the policy to none.

It turns this:

302548_pastedImage_9.png

Into this (with the default settings of the script):

302585_pastedImage_10.png

And it does it for all assignments in a class at one time.

Where I can run this?

The script can be ran from any assignment, discussion, or quiz page and it will process for just that item. For example, navigating to /courses/123/assignments/456 will set the labels for just the assignment 456.

The script can also be ran from the main page for assignments, discussions, or quizzes and it will process all of that kind of assignment. Assignments gets everything that is graded, while discussions and quizzes just change the process for discussions and quizzes.

It will not run if it's not on one of the designated pages. You cannot, for example, run it from the course homepage or course settings page. It must be somewhere under assignments, discussions, or quizzes.

How does it do this?

This may get a little technical.

When a teacher goes into the gradebook and marks the late policy status to "none", Canvas makes an API call to save that information. The script makes the API call on behalf of the teacher.

It looks for where you're executing the script from. It can run for all assignments, all quizzes, and/or all discussions, or it can run for just one of those.

Based on the type of assignment, it then fetches information about just that single one or all of the available ones of that type.

After fetching the information about the assignments, it looks at for assignments that ...

  • Are published
  • Have a due date
  • Do not have a submission type of Not Graded, On Paper, Wiki Page, External Tool, or none. The "none" was something I picked up from the source code for when it couldn't find a submission type and may not actually be there.

It takes that list of assignments and retrieves all submissions for those assignments, looking for things to change.

Here are the rules that it follows

  • Never, ever, do anything if the late policy status is set to Excused.
  • If removing the "missing" labels, it looks for submissions that currently do not have a late policy set (the policy is null) and if there is no submission, or a submission is not late, it sets the policy to "none". This disables the "missing" tag, but leaves the "late" tags.
  • There is an option that also removes the "late" labels. This didn't seem to be as big of a deal for Laura, but I can see it where someone might have turned on late penalties and then decided they didn't want it for a particular assignment. This can be used to remove that for all students at one time.
  • When resetting the values, is basically looks for the same conditions, but it sets the value back to null instead of "none". The way that late and missing are computed is different because Canvas won't say that it's late if it's missing.

Once it has determined a list of submissions that need updated, it makes the API call to set the late policy status.

This script can be repeated at any time. If it takes too long the first time, run it again. It will still download the list of assignments, but it won't have to send the updates for those assignments it previously handled, so it will be able to get to more of the assignments and submissions each time it's ran.

My testing was limited. I had 91 assignments and only 3 students, but it was running in just a few sections. Laura's class is divided into 3 sections, so there are 6000 submissions per class to handle. It will be interesting to see how it works for her.

Finally, I didn't really do any error checking for failed API calls. If it happens, run it again. This isn't intended to be a polished release like many of my scripts.

How do I use it?

Step 1: Make a local copy

Open the source code to the script and copy/paste it into a text editor. It may help if you click on the Raw button (1) before you try to select the code.

302545_pastedImage_1.png

Then take a look at the options in the config section (2) to make sure they're what you want.

  • missing: If this value is true, then it will set the late policy for any eligible assignment to "none", effectively removing the "missing" tags. This can be done pre-emptively at the beginning of the course. It does not disable the "late" tags.
  • late: If this value is true, then it will remove the "late" label from assignments by setting the late policy to "none". This can only be done after an assignment is late as submissions after the due date will reset the policy.
  • reset: If this value is true, it restores the default Canvas behavior.
  • debug: If this values is true, then Canvas will log information about the throttling results to the console. The threshold starts at 700 and if ever gets down to 0, then the API calls stop working. This is for those really impatient people who want to make it go a little faster.

Step 2: Execute the code

  1. Navigate to the location (see below) where you want to run this in Canvas
  2. Open the developer tools in your browser. For most browsers, this is F12 although you can also right-click in the browser and choose Inspect (Chrome) or Inspect Element (Firefox).
  3. Switch to the Console tab in the developer tools:
    Chrome:
    302546_pastedImage_5.png  
    Firefox:
    302547_pastedImage_6.png
  4. Paste the code (make sure you've configured it) into the command line in the Console window.
  5. Make sure this is what you want to do
  6. Press enter (Chrome) or Ctrl-enter (Firefox)

You may need to run it again if it didn't get all the way through the first time. Inside the console, you can just hit the up arrow instead of pasting the code again. Also, the F12 is a toggle, and will hide the developer tools if it is open.

Video Demonstration

This doesn't have a slick interface and it doesn't use Tampermonkey. You have to copy and paste code into your browser's console.

I covered three scenarios in the video

  1. Hide missing labels for all assignments
  2. Hide the late label for a specific quiz
  3. Restore the late and missing labels for all quizzes

Hopefully that is enough to get an idea of how to run it.

Additional Notes

This section really isn't for anyone, because you're all way more organized than I am. But just in case, here's some additional information that I discovered.

If you publish an assignment or change a due date after running this script, it will reset the late policy status to null, which basically removes anything that you've done. That means that missing labels will show up again. To get rid of them, run the script again.

If a student turns in a late assignment, it will change the status from missing to late. That means that if you want the late labels to disappear, you have to run the script again.

If you have an assignment that has a grade and you manually go through and tell Canvas that it is missing, Canvas will believe you. That makes sense, I guess, because you can use it to warn a student that "Hey, this isn't acceptable!" In my testing, I found that typing a grade into the gradebook when the policy was manually set to missing did not remove the missing tag. That's okay for Laura, who doesn't want the missing tags in there anyway, but I thought I'd mention it since it may not be obvious.

Finally, you may want to test this in a beta instance of Canvas with a previous class if you can. It works for me, but I haven't tested for anyone else.

Update 2021-02-01

I added the Bottleneck library to the code to allow for throttling. When I originally wrote the script, the browser automatically limited connections to 5-6 per domain and that kept the Canvas API happy. Since then, things have changed and the connections are faster and the script was running up against the Canvas API limits. The limit starts at 700 and when you get down to 0, it just stops delivering content and the script fails. If you re-ran the script, then it would pick up where it left off and continue.

I added the ability to output the results of the x-rate-limit-remaining response header so you can see how close to 0 you are getting. The default of 10 concurrent connections with 20 ms between starts never dropped below 580 for me, so it could be sped up some, but I wanted to play nice with the API, taking a slower route that is more likely to be successful.

The fetching of submissions fails with unpublished assignments. I thought I was checking this because my documentation mentions published assignments, but it must not have been in the code. It is now. Previously, if you fetched any assignments along with one that was unpublished, it would not adjust any of that batch. It batched them into groups of 10, so some people might have been seeing some assignments never being fixed before. That is resolved.

There was an error in the regular expression used to find the next link header. It was getting the right link ... eventually, but it was making more calls than needed. I changed <(.*?)> to <([^>]+)> and now it only picks up the next link instead of the current one as well.

I also updated the code to use ES6 arrow functions. I now have an IDE that supports ES6 code (bye-bye Eclipse) and updated the code to remove some other warnings and messages.

81 Comments
breklis
Community Participant

@bbennett2  Thanks!

We'd like to see options for different colors missing/late tags on the student-facing end (at least the late tag to differentiate from the missing tag).  Updating the status colors is only for the teacher's gradebook.

missing & late tags - canvas.png

saltman
Community Participant

@James if you end up making a grease monkey version or a slick interface or something, would you let me know?  I showed this to my more open-minded tech-consultant and he was still a little leery.  Anyway!  Appreciate you!  Most of the links to this idea disappeared... broken-link sadness.

James
Community Champion
Author

@saltman

Thanks for the kind words.

The original intent of the script was to be ad hoc, which is one part of why I never put a smooth interface on it. I saw it more as a we need to do this once a semester, not on a regular basis. That could have been based on the feedback I was getting from the person requesting it.

Now, Canvas has sped up processing speed, so I would probably need to add throttling to the code to make it run reliably without timing out for large classes or for all assignments at once. I debated with myself at the beginning about adding a dialog box to let people pick what they wanted to do with. Ultimately, it was a script I was writing at the beginning of a new semester and I had to get my own stuff done. Then Jared said to look for things from Instructure and it wasn't a high priority. Now, development time for me is almost null because teaching online takes a lot more time than teaching face to face.

laurakgibbs
Community Champion

Hello @James and everybody! I went to run the magic script today for the first time, and got a raft of errors. I used the same procedure as usual, opening the Assignments page for a course in Chrome, going to Developer console, pasting in the javascript. I'm not sure what the errors mean, but it looks like all (?) the labels are still there after I run the script; I can't think of what I might be doing wrong on my end, but I hope to get this working again. Esp. in the pandemic, I would like to save my students unneeded red-ink-stress. It worked like a charm all last semester!

I'm going to go give a quick try in Firefox to see if I do better there.

 

Screen Shot 2021-01-27 at 1.11.47 PM.png

laurakgibbs
Community Champion

Same apparently in Firefox (I've never run the console in Firefox, so I learned something new anyway!)

Screen Shot 2021-01-27 at 1.19.55 PM.png

laurakgibbs
Community Champion

One last bit of information: I ran it AGAIN, still got the error messages, but it looks like the labels ARE gone now.

So perhaps no worries after all: I have no idea what all those error messages are, but if I can run this twice and make all the labels go away, that works!!!!!!

So, THANK YOU again for helping me to get rid of the red ink. This is my last semester teaching, so I just need the javascript solution to hang on for just one more semester! 🙂

techalvarez
Community Member

Is this still the way to go for fixing this issue or has canvas corrected this?

laurakgibbs
Community Champion

Yes, as far as I know this is still the only way to fix this problem since Instructure has not given instructors control over our own Gradebook. Without James's script, I would have to stop using the Gradebook and find some spreadsheet-based solution since the labels are just wrong (literally incorrect) when applied to my Gradebook; details:
Canvas and the Botched Gradebook Labels: Why haven't they fixed this yet?
https://oudigitools.blogspot.com/2019/08/canvas-and-botched-gradebook-labels-why.html

I ran the script again this morning. I got the same long list of error messages, and, strangely, there were "missing" labels that were still appearing this morning; in the past, I only. had to run the script ONCE all semester to take care of the missing labels, for the whole semester, but I had to run it every week to remove the late labels. So, I don't know what's going on, but after I ran the script this morning, the missing labels were removed. I'll find out tomorrow if they show up again.

I no longer participate here at the Community, so I don't know if there has been discussion elsewhere about this ongoing problem.

I'm glad this is my last semester teaching; if I'm not able to find a way to get the red labels under control, I will just make a blanket apology to the students and ask them to please try to ignore them. But hopefully somehow or other I can muddle along running the scripts every day if I need to; having the missing labels show up every day is a real problem, and in the past the script had solved that problem for the whole semester; I only had the late labels to worry about from day to day which is less misleading. The missing assignments are NOT missing... and it is completely confusing to tell the students that they are missing when they are not.

techalvarez
Community Member

I agree. My missing labels sync to our gradebook called Skyward and they alert students and parents of missing assignments even if a kid got 100% on it. I just tried the script for the first time and it appeared it works. I am curious how often I will need to run this.

laurakgibbs
Community Champion

Update: I got fewer and fewer error messages each time i ran the scripts, and today I was able to run the script for both classes with no error messages (in one class), and only a few errors messages in the other class, and then when I ran the script a second time in that class, no error messages.

I have no idea what's going on, and am glad to help troubleshoot, but if I can just get rid of the labels, I don't mind running the script multiple times! 🙂

James
Community Champion
Author

@laurakgibbs, I think the problem is related to throttling. When I wrote it, the browser was limiting the number of concurrent requests to 5 or 6 and that provided built-in throttling. Now it allows requests to be sent much faster than before and Canvas is saying that we're making too many requests too quick and shutting it down. This is consistent with all of the red error messages showing up in the logs you sent from before.

That may be why it works for a single assignment (and small classes), but not when you try to do all the assignments at once. The solution is to include a throttling library (I've used Bottleneck in other places).

The problem is finding the time to fix everything. Since COVID hit, I haven't had time to do much coding outside of class-related material. On the flip side, I have nearly automated most of the Canvas Studio processing outside of uploading the video. I automatically caption, set the name, description, and tags based on values in a spreadsheet. Then I even wrote code that will take the ID number of the video and embed it with the heading, description, and embed the video if I just go [[12345]] in the content of the page. I uploaded 42 videos this weekend and it saves me a lot of repetitive clicking. It also helps standardize all of my content, which wasn't a thing before COVID.

laurakgibbs
Community Champion

Oh, that makes PERFECT sense, James, and fits with the way I can run it multiple times and it eventually returns no error messages, which is probably the easiest solution for me since I don't need a throttling controller for anything else. Eventually the fixes all get made, and today it just took three runs total across two classes, which is not a problem at all.

And just to say as always THANK YOU for this script, and also for ADJUST ALL DATES. I would be lost without them!!!

Sending best wishes to you and Kona! 🙂

 

James
Community Champion
Author

@laurakgibbs 

I just made an update to the script to throttle the connections so they don't fail. I also found a couple of logic errors that probably explained earlier issues with it not running from the discussions or quizzes page when there were more than 30 of them, but working from the individual assignments.

If anyone copies the script, pay attention to the configuration settings that you originally had and make sure you set the script back to those.

Here's the full list of updates from 2021-02-01.

I added the Bottleneck library to the code to allow for throttling. When I originally wrote the script, the browser automatically limited connections to 5-6 per domain and that kept the Canvas API happy. Since then, things have changed and the connections are faster and the script was running up against the Canvas API limits. The limit starts at 700 and when you get down to 0, it just stops delivering content and the script fails. If you re-ran the script, then it would pick up where it left off and continue.

I added the ability to output the results of the x-rate-limit-remaining response header so you can see how close to 0 you are getting. The default of 10 concurrent connections with 20 ms between starts never dropped below 580 for me, so it could be sped up some, but I wanted to play nice with the API, taking a slower route that is more likely to be successful.

The fetching of submissions fails with unpublished assignments. I thought I was checking this because my documentation mentions published assignments, but it must not have been in the code. It is now. Previously, if you fetched any assignments along with one that was unpublished, it would not adjust any of that batch. It batched them into groups of 10, so some people might have been seeing some assignments never being fixed before. That is resolved.

There was an error in the regular expression used to find the next link header. It was getting the right link ... eventually, but it was making more calls than needed. I changed <(.*?)> to <([^>]+)> and now it only picks up the next link instead of the current one as well.

I also updated the code to use ES6 arrow functions. I now have an IDE that supports ES6 code (bye-bye Eclipse) and updated the code to remove some other warnings and messages.

laurakgibbs
Community Champion

Thank you so much, James! Now that I've got an all-clear with my classes, I'll just be running the script every week on Monday afternoon (removing the Late labels that accumulate each week), so I will try out the new version of the script when I run that next Monday afternoon. I'll make sure to report back. YOU ARE AN API SAINT! 

James
Community Champion
Author

You're welcome. And thank you for all the inspiration people have taken from your work.

dtod
Community Contributor

I haven't looked at this closely but:

.student_assignment editable .submission-late-pill, .student_assignment editable .submission-missing-pill {
display: none;
} 

or

.student_assignment editable .submission-late-pill, .student_assignment editable .submission-missing-pill {
color: #yourpreferredcolor;
} 

 

Could be applied via a jquery call if you can't customize the CSS, but I'm sure an institution could do the same for the student view.

James
Community Champion
Author

@dtod 

David,

Unless things have changed, faculty cannot implement JavaScript or CSS on their own. This solution would require the local Canvas administrator to make those changes, which means it would need made for an entire [sub]account.

Still, that may be an acceptable route for some people who want to hide the labels, so thanks for sharing. This is especially true if there is a group that wants this for all of their courses (say the college of education). It can be implemented at the individual course level by adding body.context-course_12345 (where 12345 is the Canvas course ID) as the prefix, but that would need repeated for each course ID.

Hiding is not the same as removing that missing or late status, though. In Laura's case, she had multiple assignments that the students could chose from and they were not to get penalized for the ones they didn't complete. If a course has a missing policy and there are due dates on assignments, then Canvas will automatically apply the missing policy, effectively penalizing the student for an assignment that was optional. In a situation like that, the missing tag needs removed, not just hidden from view.

AlisonChilds
Community Member

This is amazing and saved me so much time making small edits to the gradebook. I was sharing it with my colleagues and someone asked if there was a similar tool to ADD missing labels when the gradebook won't do it automatically (for us that is when we use external tools like CK12). If a student doesn't complete them we have to change the status for each student manually.

 

Again- thank you so much @James  

James
Community Champion
Author

@AlisonChilds 

I believe the script will also add missing labels, but you will need to edit it to remove the check for external tools. I excluded them since Canvas doesn't add missing labels to external tools.

AlisonChilds
Community Member

would that mean I just delete where external tool is listed here: 

AlisonChilds_0-1614618352457.png

 

and do I need to change the missing label line to "enable missing label"

AlisonChilds_1-1614618410323.png

 

 

Sorry I don't know about coding but am great at following directions 🙂 Thanks again @James 

 

James
Community Champion
Author

@AlisonChilds 

Looking at the code, it looks a little more complicated than that. removing the external_tool and changing reset=true will almost do it, ... if you set the status in line 171 to something other than null.

I would need to dig into it more to give a definitive answer and I have to go somewhere right now.

RaoulRodriguez
Community Member

If you use this tool, can you still individually mark an assignment as missing?

AlisonChilds
Community Member

@RaoulRodriguez I just tested that out on an assignment I used this tool on- and I was able to make changes to individual student statuses

 

James
Community Champion
Author

@RaoulRodriguez, the script operates on whatever the settings are at the time you run it. It does not persist, so any changes you make after you run the script will overwrite what the script does.

Nhadley12
Community Participant

This seems super straight forward, copy, paste, run. However in my canvas world, it doesn't do anything. Just says Done, and then none of the assignments are changed. 

irsarahbean
Community Member

same as Nhadley12

agessama
Community Member

I packaged this up as a user script to make life easier for some of our teachers. It's basically @James' code with a mutation observer to add an item to the overflow menu to trigger the script. Right now it works but doesn't provide any visual feedback to confirm that it ran. Maybe in v2.

I also added a bit of logic to identify if there was a score entered manually for the assignment and to remove the missing flag conditionally based on the presence of that score. This handles the case where some assignments are submitted on paper and others are submitted online.

This is a hack, but if it is useful to anyone else here it is: https://github.com/agessaman/canvas-tools/tree/main/fix-missing

 

Nhadley12
Community Participant

Has anyone found a way to pop this into TamperMonkey? 

RobinCoffman
Community Novice

Jasmes, I have a question, my Canvas when translating to PowerSchool is using the completed flag. Is there a way you can use some code to turn that off? That you so much for your help!

James
Community Champion
Author

@RobinCoffman 

I'm not sure what you mean when you say they are using the completed flag. There is a submitted_at value for online submissions, various workflow_state values, the Boolean late and missing flags, but I do not see a completed property for a submission.

jalexander
Community Explorer

I had been using this script successfully for about a year, then it suddenly stopped working for me in Spring 2023. I re-copied the code and tried it again....still nothing. 

I hate the automatic "late" codes on assignments.  Sometimes I give kids extra time to finish their work.  Other times, students turn in their work on time but I ask them to correct their work and resubmit it.  Either way, Canvas marks it "late" which is misleading and annoying.  Any idea how to fix this?