Removing Missing and Late Labels

James
Community Champion
81
26343

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
kona
Community Champion

Thank you  @James !! You just showed why even though I have (way) more points, you are the true #1 Canvas Community MVP!!!

I will also verify he really is crazy insanely busy right now... and has had the youngest Jones (age 2) home with him way more than normal. 

laurakgibbs
Community Champion

Oh my gosh,this is going to be amazing! I will run it on some past classes where we retroactively applied the new Gradebook to test it, and then I'll be LABEL FREE in my real classes.

I have some things to do first this morning, and then I'll comment back here with results on my test runs.

THANK YOU THANK YOU THANK YOU, I really cannot say it enough. 

Pinging  @jared ‌ for the amazing power of the Community and of King-of-Code James Jones in particular!!!

laurakgibbs
Community Champion

THIS IS SO COOL.

I wanted to test it in an old course first (the same course where I took that screenshot of a student's record that I put in the blog post).

The first time I ran it in an old course, nothing happened; the script ran in a microsecond. I tried it on quizzes, on assignments, and on a specific assignment; same result each time.

But then I thought maybe the course needs to be open for business, so I extended the end date of the course to Jan. 31, and then I ran the script again.

And it is still running.

And running.

And running.

I'm watching it. It's mesmerizing!

Still running...

screenshot ofbrowser console

laurakgibbs
Community Champion

IT WORKED!!!!!!! The Missing labels are GONE! Here is the same student from the screenshot before; no more Missing labels. This means I can put the due dates back on all my optional assignments (I had removed them because of this problem).

I am going to run the script again for Late and see how that goes.

THIS. IS. AMAZING.

I loved being able to watch it run in the Console. I've never run a script and watched it before.

Absolutely wonderful.............

THANK YOU

THANK YOU

THANK YOU,  @James ‌ ... you are the miracle-worker!

screenshot after script

James
Community Champion

That's good information to know that the course has to be available for grading.

llane2
Community Member

This is brilliant,  @James ‌ - thank you! My own to-do list frequently has items that start with "use James' spreadsheet to..." This adds another.

And thank you for sacrificing your time for ours! 🙂

 @kona ‌ would you mind adding this to your Canvancements page? That's my go-to page...

kona
Community Champion

Yes, I will definitely add this!

jared
Instructure Alumni
Instructure Alumni

YOU sir, are amazing.

This looks like a great temporary solution to the problem. I say "temporary" because based on a conversation earlier today with our Product leaders, I'm confident we will implement a change in Canvas that directly addresses this.

James
Community Champion

This is good news  @jared  . I was hoping it would be temporary -- that's part of why I didn't take time to develop a slick interface.

kona
Community Champion

Added!

laurakgibbs
Community Champion

And that is fabulous news also,  @jared ‌!!!

Yay for all the genius coders and engineers: you make it all work!!!

laurakgibbs
Community Champion

My last empty seat filled for the semester (I think), so I am running the script now in each of my 3 classes. All this week I was manually removing missing labels for students where I recorded something for them manually (the first week is full of weirdness anyway)... I am sooooooooo glad the students will not see any missing labels after the magical scripts have run.

Scripts running now.

THANK YOU SO MUCH,  @James ‌!!!

kona
Community Champion

So happy this is working for you and your students! 🙂

laurakgibbs
Community Champion

Hi  @James  It looks like there might be (???) some unintended side-effect of the script for the way Canvas handles messaging in the Gradebook. It's NOT a problem for me, but I wanted to report it in case it could be useful to you and/or Canvas engineers. I'm pinging  @jared  for this also to pass along to the engineering team.

For the first few weeks of the semester, I message students who are not done with the end-of-week assignments. The way I do that is to pick one of those assignments in the Gradebook and send a message via the Grade to students who have not turned it in. Weirdly, though, that does not work anymore: when I have "haven't submitted yet" as the filter, I get no results:

screenshot of Canvas message filter

But if I select "students who have not been graded," then I get the expected result, which is the students who have not turned in the assignment. This is just a partial screenshot to hide the student names, but you can see the blue blobs there indicating students, and the scrollbar to scroll down through the list of students:

screenshot of gradebook filter

I was curious if running the script with the "reset" option would put things back to normal, so I took a single assignment, ran the  'reset' : true version of the script, and then I tried messaging in the Gradebook again for that assignment, but I still got the same unexpected result. Canvas doesn't recognize that students have not turned in the assignment, but it does recognize their assignment is not graded.

Anyway, this is NOT a problem for me; I can use the "haven't been graded" filter to get the students I need, but I thought I would report this oddity, as I guess it relates somehow to Gradebook settings altered by the script; I ran the  'missing' : true version of the script for all my classes on Friday. Whatever variable Canvas looks at to decide if a student "hasn't submitted yet" seems to be affected somehow as a result of the script.

James
Community Champion

This sounds like the intended behavior. By overriding the submission status and saying it's not missing, you're telling Canvas that these students shouldn't be considered as missing the assignment, which is roughly equivalent for these kinds of assignments to someone who has submitted.

The reset portion of the script didn't get as much testing from me as the other, but it did return the gradebook to the same way that it was. I did not look at the "message students who" functionality of it, though. You probably did this, but just in case you didn't, you would need to reload the gradebook after running the script on that quiz.

laurakgibbs
Community Champion

Thanks  @James  for the info! I did reload the Gradebook after the reset, but I didn't actually log off / log on again, so I might give that a try just out of curiosity.

As for intended behavior: I thought "missing" was something that only kicked in after a due date... but now I see what you mean: it's not even "missing" before the due date. Ha! Luckily "not graded" also works just fine for my purposes.

Still, I can imagine that would need to be explained clearly to people. I was thinking (wrongly) like this set of possible states:

before due date: turned in OR not turned in 

after due date: not missing OR missing

James
Community Champion

Remember that it is the "late policy status" that we're talking about, not the status of the assignment.

There are five states: default, none, missing, late, and excused

  • The default is actually null in computer terms, meaning that no late policy has been set. It allows Canvas to do it's thing. It's thing depends on policies that you may have set up at the course level. In my course, it wouldn't do anything other than flag the student because I haven't set up any late policies. Late Policies: Instructor FAQ 
  • none means that the user has overridden the default and told Canvas that this assignment should have no late policy applied. This can be set at any time, but changing a due date or submitting an assignment seems to reset it to the default of null. You cannot set null manually from the web interface, so the only way to turn off missing, late, or excused is to set the status it to none.
  • missing means that the assignment is forced to be marked as missing / no submission. The late policies allow for some weirdness, like you can give partial credit for missing work. People wanted to take away a certain percentage for being missing like it did with late, but Canvas decided to give partial credit for missing. For late, a 20% meant to deduct 20%, while for missing, a 20% meant that you got 20%. That never made sense to me (or a bunch of other people) until I started exploring this. Missing doesn't necessarily mean that it's missing. One use case would be if a student turns in a substantially incomplete assignment and you want to give them another opportunity. You could mark the assignment as missing, even though they turned in something, and then give them the points for having a missing assignment, which may be more than 0. As a status, this could be applied before or after the due date. Before the due date, it might be a reminder that "hey! this is missing." I would caution against that use, though. I think in my testing that applying a missing status and then having the student turn something in did not override the missing status, but I don't remember for sure and I wrote it down somewhere. Anyway, if that's what I remember, then marking something as missing to get the student's attention would cause it to be missing, even if they turned it on time.
  • late means that the assignment should be counted as late, no matter what it really is. This only makes sense to be applied after the due date as submitting something that is marked as late before the due date would reset the late penalty. I'm not even sure it was possible to mark something as late ahead of time, I'd have to double check.
  • excused means the teacher has specifically said this should not count for the student. There cannot be a grade associated with it and it does not count towards the point total. It can be set at any time.

What Canvas does with things depends on the late policy status. The reason my script works (mostly) is because it sets the policy to none. That forces an override of missing so that if they never do the assignment, it shows up as normal without the missing tag. If they turn in something, then it resets the status and if it's late, it shows up as late. A submission cannot make it say missing and in the absence of a submission, it won't override the none to become missing. So it hides the missing flag until they turn in something, but turning in something will never set it to be missing, only possibly late. Therefore you cannot have a missing tag -- unless you manually change it -- by preemptively setting all statuses to none.

You can get a late flag to show up, which is why you would have to rerun the script to clear out any of those.

If the reset didn't work, make sure that you also have the thing that you're trying to reset set to true. If reset is true without missing or late also being true, it won't do anything. Another thing to check is to open up the network tab and make sure it's actually doing something. It's possible that it's being ran from a page that it doesn't look for. Since your assignments are all quizzes, you should go to the Quizzes page, then click on the Quiz, then open up the developer tools and run the script. I've had cases where I've opened up the developer tools and then inadvertently gotten into a different tab (speedgrader opens a new tab) and so I'm operating on the wrong page and nothing happens like it's supposed to.

laurakgibbs
Community Champion

I hear you,  @James ‌! My point was that if "not turned in" is shorthand for "not turned in AND late policy status not equal to none" then it's going to be up to Instructure to make that clear to users. Because otherwise "not turned in" looks like it would mean what the words on their own say: "not turned in." 🙂

Of course, it could be that in the Instructure solution, they will be using some different way to manage the filters for messaging in the Gradebook now that the late policy landscape has become more complex.

laurakgibbs
Community Champion

Just to say thanks again for this script: I had a student add today (long story), and when I looked at his page it was a red wall of missing labels, but I ran the script and ... magic! ... everything was fixed. Thank you for the script and for making it so easy to run!!!

James
Community Champion

laurakgibbs, I look forward to the day that Canvas gives you their better solution, but thanks for being on top of it and relieving the student's anxieties.

laurakgibbs
Community Champion

 @James ‌ I wanted to share this snippet of a student's blog post with you; she wrote about how she is glad not to see the missing labels in this class which she is seeing in another class; I left her a comment so that she can either tell her other instructor about your script or have me contact them if she is not comfortable with that. In any case, this is the kind of spontaneous feedback I really value from students, and I am glad I am not creating stress with red labels. THANK YOU SO MUCH for creating this script for us to use!

screenshot of blog post

laurakgibbs
Community Champion

Hello  @James ‌!!! Happy Fall 2019! I am so sorry to bother you with a question about the script, but I went to run it today on my classes to forestall the missing labels that will start appearing tomorrow, but the script did not seem to work like before: instead of seeing the network view go zip zip zip zip through a whole series of transactions, it just stalls out:

screenshot of performance tab in Dev view

And here's the detail on the unread_count:

unread count detail

And there was also this error message, although I don't know if the error message is important; it looks like an error on the Gradebook page itself, not anything to do with your actual javascript:

screenshot of error report in Console

I've tried it several times, waiting 5 or 10 minutes each time, and it just seems stalled

It could be that my school's system was just overloaded with it being the first week of classes maybe, so I will try again tonight. Meanwhile, if there are any other screenshots I can share, let me know. I don't know what I will do without this script... Whenever I ran the script last semester (and I ran it once a week on each class), I never had it stall out like this. There's nothing different about the Gradebook set-up I'm using; same number of items, same number of students, and I'm using the same browser/computer as last semester.

Again, so sorry to bother you....... but I am indeed totally dependent on this script.... thanks in advance for any help/insight! 🙂

laurakgibbs
Community Champion

I started seeing the red labels popping up tonight (which is really frustrating; I am working so hard to build trust with students and this misleading labels make that harder)... so I tried running the script again, and it just hangs on that "unread count". Here's a screenshot.

I should have run the script earlier, but since it worked so perfectly last semester, I was waiting until my enrollment settled down before running the script to start the semester. I still cannot believe Canvas insists on sending messages to my students about their work like this, when it is not the right message to be sending... but there they are, red late labels to shame anybody who had to use the grace period today... sigh.

screenshot of label script running console _ network report

laurakgibbs
Community Champion

In desperation I gave it one more try, and no luck; it's definitely not working like it used to. If you have any insight,  @James ‌, I would be very grateful, but I'm starting to realize that I may be stuck with the Gradebook labels this semester.

Labels I don't want, labels I don't need, and labels that are not helpful in any way. And they are definitely not "uplifting" ha ha. 

Anyway, if you have any suggestions, I'm getting a consistent result each time; here's the latest screenshot.

Last semester, it always just ran lickety-split, very fast, no problems of any kind.

Nothing is changed on my end, though I suppose my school could have done something that I don't know about.

screenshot of labels script running_not-running

James
Community Champion

laurakgibbs,

I am acknowledging your request for help. I'm a little backlogged right now with the start of my own courses and haven't been able to devote much time to fun little projects recently.

Your screen shots don't make it look like it stalled out, it makes it look like it never got started. None of the network calls you're showing are from the script. That is consistent with the next paragraph.

I can't tell for sure because the developer tools cover it up, but it looks like you're running this from the gradebook page. I don't remember writing it that way, I thought you had to run it from the assignments main page, the quizzes main page, the discussions main page, a specific assignment, a specific quiz, or a specific discussion. The gradebook is a complicated beast and I've purposely avoided doing anything to that page. I just checked and the first few lines of code verify that it checks what page you're on and the gradebook isn't one of them. 

If you're on the wrong page, then it definitely won't work. In fact, it doesn't stops with line 20 and so it never attempts to make any of the other calls.

On the other hand, it is very possible that Canvas has changed something. I know that the grade posting policies have undergone a lot of work, especially in July when they were confusing to everyone. Before I make time to work on this, can you verify that you're on one of the pages that the script actually runs on?

laurakgibbs
Community Champion

Thank you for checking in,  @James ‌!!! I figured the start of school year was completely hectic for you.

I always ran it from the Gradebook page before, but I can try the Quizzes page! I'll go do that now. THANK YOU for the suggestion; I was just doing what I did last time. Fingers crossed... I'll report back what I learn....

laurakgibbs
Community Champion

Oh my gosh, ASSIGNMENTS does work!!! THANK YOU,  @James ‌ ... quizzes didn't work, but assignments does! I'm getting the network action I used to see. 

THANK YOU!!!!!!! I couldn't even figure out what I was going to do without this script. I thank you! My students thank you! Red labels, be gone! 

script running

James
Community Champion

I hope it actually gets rid of the red and that Canvas didn't change that part.

laurakgibbs
Community Champion

I had a student who I know had labels because he was running late... so I was able to check him to make sure it really worked, and his labels are now gone! 

Seriously, this is so great.

Seeing all that red as students were just getting started was such a bummer. Now they can believe in the grace period for real. As advertised in the syllabus, ha ha.

THANK YOU!!!!!!!!!!!!!!

keith_oatley
Community Member

Thank you very much for this. It is most helpful. Would it be possible to add an option to only get rid of the "Missing" for ones with grades greater than zero?

James
Community Champion

 @keith_oatley ,

I'm not sure that I follow. You want to have it say "Missing" if the grade is 0 but not say missing if the grade isn't 0? I think this means you want it to be missing when they scored 0 points on it but if you gave them points of some kind, then it's not missing. That is, if a student did terrible and didn't get anything right, you want it to say missing, but if they did really bad and scored 1 point, then you don't want it to say missing.

I don't use this myself and it was an ad hoc development for my friend laurakgibbs, so I'm a little rusty on what it does. I purposefully didn't finalize it because it is very much a hack and Canvas said they were working on it.

A quick look at the code looks like you could add a check on line 140 to accomplish what you're asking for.

Currently, it reads has this code:

      } else if (submission.late_policy_status === null) {
        if ((config.missing && !submission.late) || (config.late && submission.late)) {
          status = 'none';
        }
      }‍‍‍‍‍‍‍‍‍‍

If you modify line 140 to incorporate submission.entered_score > 0, then you should get what you're after.

      } else if (submission.late_policy_status === null) {
        if ((config.missing && submission.entered_score > 0 && !submission.late) || (config.late && submission.late)) {
          status = 'none';
        }
      }‍‍‍‍‍‍‍‍‍‍

This is untested as I'm not completely sure I understand the request and I don't have a good place setup to test it. You should probably test it your beta instance of Canvas before unleashing it on a live course.

There is also a submission.score, but I haven't completely explored what that represents. It might be the score before faculty went through and manually graded quizzes. Anyway, went I checked in Canvas, the entered_score was watch matched the displayed score (at least for the one student I checked).

keith_oatley
Community Member

Thank you for this. Including "submission.entered_score > 0 " seemed to work (although my attempts to "reset" did not work after making this adjustment.) My reason for wanting this is that, when you allow an assignment to be submitted online but  some students submit it in hard-copy, then even though you may have marked them and entered a marks the ones submitted in hard-copy will automatically go to "Missing" after the due date. I would dearly love to stop this happening but at least your script allows me to remove the "Missing" status from the ones that have been submitted and marked without removing it from the ones which have not been submitted.

James
Community Champion

Thanks for the explanation.

The reset code was in a different section of the code, right above it at line 135. I'm not sure how you want to reset it, though. Do you mean that you want the scores that were greater than 0 to be reset and once again listed as missing or that it reset it when you didn't want it to be reset? If you mean the second case, then you can add the same "submission.entered_score > 0" on line 135 so that that first conditional is (config.missing && isMissing && submission.entered_score > 0).

brian_t_anders
Community Contributor

Upon discovering that assignments requiring an LTI for submission aren't marked as missing passed the due date, I need to do the reverse of this. Find all of the assignments that the due date has passed that do not have a grade or a submission, and mark them as missing. Has anyone experienced the same need?

James
Community Champion

 @brian_t_anders ,

You would want to be careful doing this. LTIs are not automatically for a reason (or more than one). The process of updating grades varies from LTI to LTI. Some may update the grade as soon as the student attempts the work, while others require that the instructor publish the grades from the LTI back into Canvas.

In the first case, marking them as missing would be good, but in the second case, it would be confusing if the instructor forgets to go in and the students get all kinds of missing labels. If you knew which kind of LTIs you had, it may have merit.

Off the top of my head, you should be able to modify the script to check for the submission_type on the assignment to see if it's an external tool.

brian_t_anders
Community Contributor

Every assignment that we have that would need this is a Google Cloud Assignment. In my experience, Google Cloud Assignments immediately update and the submission date in the SpeedGrader is exactly what it is using the LTI.

In one of our courses, all of the assignments are Google Cloud Assignments and all of the quizzes are created in Canvas. Also, this specific course has many students who need an extra push to get work done, and having only MISSING tags on quizzes, when indeed there could be Google Cloud Assignments that are missing, is inconsistent and unhelpful. It's also a bit unreasonable to ask the teacher of the course to manually mark each missing assignment.

James
Community Champion

Every assignment that we have that would need this is a Google Cloud Assignment.

If I read this correctly, then it sounds like you may want to check the LTI to make sure it's a Google Cloud Assignment as there may be other LTIs involved that you don't want this to happen with. If you meant that you only had Google Cloud Assignments and not other LTIs, then that wouldn't be necessary. Right now, New Quizzes is an LTI so that's something to bear in mind.

When you fetch the assignment information, there is a submission_type array that should contain external_tool. That would let you know that the assignment type is an LTI.

To identify that it's a Google Cloud Assignment, you should use the external_tool_tag_attributes object that has an url attribute. It can be checked to see if it matches the URL for a Google Cloud Assignment.

That should help you narrow it down to the cases you want -- just a Google Cloud Assignment external tool.

Next comes the automation aspect of this. That script was never intended to be a long term solution; I didn't even bother to put an interface on it. It needs to be ran within the browser for each course because it fetches the information from about the course and assignment from the browser.

It sounds like you need it to be ran frequently for many courses. That means that we need to migrate it to something that can be called through some kind of program using the API.

The Grade of comment on multiple submission endpoint of the Submissions API allows you to update information for many students with one API call, but it doesn't explicitly mention the late policy. The Grade or comment on a submission endpoint does have the submission[late_policy_status] that you can set to late, missing, none, or null, but it only works on one student submission at a time.

Sometimes there are undocumented values that work, so I tried sending a late_policy_status of missing with the multiple users. It came back as success and the posted_grade updated, but the late_policy_status did not.

Falling back to the single-submission version, it did work. This requires a PUT statement, rather than a POST, but that also means that you can include the payload in the query string if you like.

As JSON, the payload looks like

{
  "submission": {
    "late_policy_status": "missing"
  }
}

As part of the query string, you just tack this onto the end of your URL that specifies the course, assignment, and student ID. (I've line-wrapped this for readability)

PUT /api/v1/courses/:course_id/assignments/:assignment_id/submissions/:user_id

?submission[late_policy_status]=missing

Much of that is already in the code, but you'll have to supply the logic to determine the course and bypass that of skipping LTIs, instead operating only on the Google Cloud Assignment. You'll also need to tell it to set the missing status rather than remove it. Your task doesn't require a lot of what's in the code, so you could strip out the part about discussions and quizzes. That's part of why I gave the logic you need since you may end up with a very pared down version of what I have.

I can think of one possible gotcha. Since Canvas doesn't process LTI data in terms of missing and late, there's a chance that setting the missing status will make it so that it doesn't get reset once a student submits the assignment and it will still show up as missing. I haven't tested this, I'm just trying to think of possible issues ahead of time.  Have you verified that the manually applied missing tag gets reset when a student submits the Google Cloud Assignment? If not, you'll also need to apply the logic to remove the missing status once they turn it in. But it won't be real-time unless you use Canvas Live Events and watch for assignment submissions.

James
Community Champion

 @brian_t_anders , 

There's a feature request that you might want to vote for and provide your use case for: https://community.canvaslms.com/ideas/15440-new-gradebook-functioning-with-external-tool-lti-assignm... 

brian_t_anders
Community Contributor

Thanks for pointing me to this!

jenna_scheub
Community Participant

 @James ‌ can I get your help too?? I'm trying to run this code and am hitting some unidentified wall!

I tried editing the code so that it would only remove the late labels. I also tried out the line 140 edit per the comments above.

Here is my code

Here are some screenshots. I think I'm stuck in the land of "unread" 

332401_Screenshot 2019-12-11 16.00.48.png

332411_Screenshot 2019-12-11 16.00.32.png

Any advice would be most welcome!!!

James
Community Champion

 @jenna_scheub  

The line 140 stuff was only necessary for people who wanted to reset the missing status. Since you have config.missing = false, it won't do anything.

I cannot tell from your assignment list what you're expecting to happen, because the late policy doesn't show up on the assignment page. Maybe you were just trying to show me where you were running it (but you showed it twice). Also, are you doing this in your beta instance so it doesn't affect student grades until you're sure it works?

I have a couple of thoughts, but realize these may not lead anywhere. Your network traffic shows that it only made one call (or the others were too far down to see). That means it didn't find any suitable assignments.

  • Have you tried running it on a single assignment before you try running it on all assignments? Go into the gradebook and find an assignment that has students with a late flags on it. If it works there, that might indicate it's a problem with fetching the complete list of assignments. You might see if it's fetching the IDs properly by inserting a line before the return in line 185 that has console.log(assignmentsIds);
  • Do you have any actual assignments that are capable of being late? These assignment types are excluded by Canvas and my code: 'none', 'not_graded', 'on_paper', 'wiki_page', 'external_tool'. The first section you had was called "ungraded"
  • The "unread" bit is something Canvas does to see if there's any new messages for you. You can cut down some of the crap by changing All to XHR on the Network tab, but it won't completely clean it up as the unread count thing is an XHR call. You can also clear the network traffic before you run the script.
jenna_scheub
Community Participant

Thanks for that bit of feedback  @James . Yes, I was trying to show where I was running it along with the unread list (1) and some of the code (2). The first part of my assignment page only showed the ungraded assignments. I use a variety of submission styles across my graded assignment categories: text box, google cloud, drive attachments, etc. 

It's true: I was boldly trying it in my entire gradebook. I have a "no late fee" policy in my classes, which is why I would very much like to turn the late label off. Here is how I have it set in the gradebook.

332440_Screenshot 2019-12-12 08.45.08.png

I noticed that I could get the code to work on individual assignments but not on the entire assignments page.

          BEFORE                           AFTER (started the screenshot a little lower than the first)

332450_Screenshot 2019-12-12 10.48.01.png   332451_Screenshot 2019-12-12 10.48.56.png

I would also love to edit the code (if possible) to remove the missing label from any assignment with a grade >0. I thought I saw that in one of the comments but probably did not insert it correctly because I don't know the rules of this code [yet]. 

Thanks again!!

jenna_scheub
Community Participant

((because I can't figure out how to edit my previous post lol))

Is it possible to add/change the code to:

  • remove missing label for anything >0
  • add missing label to anything = 0
  • remove late label on external tool submissions like a google cloud assignment
James
Community Champion

To get the missing part the way you describe, you need the change you made on line 140. You already did that, but you also need to set missing=true at the top.

Your last item leaves me conjecturing without direct experience because I don't use Google Cloud assignments (the one time I tried this year did not go as planned).  @brian_t_anders  was working on marking them as missing. The last time I looked, Canvas shouldn't be marking external tools, which I think Google Cloud Assignments are, as missing. If I understand correctly, you are saying it will mark them as late. If that's the case, you could modify the code that checks the list of assignment types to remove the labels for. That would remove the late fee for all external tools, though. If you need to limit it to just Google Cloud assignments, there is some extra work involved.

jenna_scheub
Community Participant

I got it to work! I removed the missing label from assignments that have a grade. I still don't know why I can't run it from my assignments page :smileyplain:

The LTI's are a whole other thing and it definitely makes me rethink using google cloud assignments....

For anyone else who may be interested, here are the links to the code I used:

Remove late and missing if grade is >0

Remove late only

Thanks again  @James ,  @kona , and laurakgibbs for getting me started!

suzanne_waldenb
Community Participant

Any progress on that?

leslie_irvine
Community Participant

Why, oh why, hasn't Canvas fixed this yet?!!

breklis
Community Participant

Hi there,

 

I'm not sure if this is the correct place for my question, but I couldn't find anything about the late and missing tags in the student grade report elsewhere.  Our teachers would love to be able to change the color of the late (and missing) tags on the student end.  Right now, they are both red and very harsh.  We'd like to be able to choose a different color at least for the late flag.  Any ideas?

 

Thanks!

Barbara

bbennett2
Community Champion

@breklis In the gradebook, you can go to Actions > Statuses and edit the labels and colors for each status.

BradMoser
Community Contributor

So rad! Seriously. Love it. 🎖