Hello. I am wondering if Canvas or an external application has the capability to show me how many posts all students have made throughout the semester in a graded discussion forum. At the end of the semester, I create a curve based on the average number of posts students make and thus I need to know how many posts each student has made throughout the semester. For example, the number of posts made throughout the semester often range from 0 to 70. In Blackboard and Moodle, when grading the discussion board posts, I am given a summary that includes a list of students with how many posts each student has made. I am also provided with the average number of posts and other statistics related to their discussion board posts. This allows me to quickly determine where to set the curve.
Thank you for any help you can provide.
James, I was wondering if maybe the problem I am having is b/c I have several different discussion forums. Would this be a problem for the script you wrote?
The code fetches a list of all discussions before it starts processing them. There's nothing in the program that would limit it because of that.
However, there is is a Google Sheets timeout of 5 minutes that might come into play. No script will execute for more than 5 minutes. So, if you have enough discussions with a lot of students and it can't process them all in 5 minutes, it would stop. I'm not sure where it would stop, though. Probably before displaying anything.
Also, if your discussions were long -- like lots of embedded graphics and the like, it might also cause a timeout.
That wouldn't be my first guess, but you could edit the code and skip everything after the first discussion to see if it was working. I think you could accomplish that by adding a line that says break; between lines 110 and 111 in the discussionCounts.gs file. Those probably aren't the same lines if you removed the code for your token.
Look for this (the numbers may be off a little) and put break; before the between the two } lines
|112||header = [ '' ];|
|113||footer = [ 'Total' ];|
Then if it runs, it might be a timeout issue. If it doesn't run, it's probably something else.
Unfortunately, nothing gets timed out (the script is completed within 10-30 seconds). I end up with a "data" sheet that is completely blank. There are lots of embedded videos and such that the students include in their posts so that could be the issue but since the error message (noted in a previous post) mentions the access token, it may be an issue with my home institution and something changing in the last month. Unfortunately, it looks like I will be stuck manually tallying up all the discussion board posts for each student at the end of the semester. I do appreciate you taking the time to create this script James. Hopefully in the future it won't be needed because Canvas will provide this statistic for teachers.
Have you tried creating a new token and trying it. You may need to make another copy of the original if you've removed the lines that contain the token from your existing one.
Another (I'm stretching) idea might be that you put an end-date when you created the original token and it has just expired.
If you want to confirm that it really is a token issue and not something else that has changed, you could try this:
Go into Tools > Script Editor and choose the canvasAPI.gs script.
Find the line that mentions UrlFetchApp. There's only one and it's around line 195. You could do a Ctrl-F for it.
Insert a line after that and add Logger.log(response);
Then, after every call to the Canvas API it will try to log something. You can then view the log once you've run the script and see if data is being returned or if there is an error message. There might be too much (my first call said "Logging output too large. Truncating output." but then there was data shown after that so I know it's working).
Be sure to remove that line after testing or your log will fill up with useless crap and you'll miss the good stuff.
I figured out the problem. The problem was that even if I brought up a new spreadsheet and put in a new token, the script would resort back to my original token that had expired (this is even if I saved the new script with the new token). So that was a relief.
With that said, I need to warn anyone who is using the script that there are errors with the results (at least for me). I have had three students thus far question their discussion board grade and based on manually going through and checking their posts, I have found that the number of posts the script indicates they have is less than what they actually posted. While it has not been off by more than two posts, it does make me worry that if it is miscounting for some students, it is miscounting for others and since I have over 150 students, it is going to be a painstaking process to go through them all. I do appreciate the time that you invested in this James and I am not sure why it is not counting accurately. I will add that the posts it is missing involves only text with no attachments or anything else "fancy."
I did read somewhere that Canvas is going to talk about improvements for the discussion board in 2016 so maybe by 2017 or 2018 it will have the features that I need for my courses without having to resort to outside solutions.
There are two or three things I can think of for the miscount. That's without digging into it. These are purely conjecture on my part and no guarantee that they are correct.
The token thing makes sense. Someone else ran into a similar issue. This is documented, by the way, and was designed to be a security feature. Once you put your token in once, it saves it so that you can remove the line. That way, if someone else does get access to your file, they don't get access to your token. But that meant that unless you told it to override the saved value, it would continue to use it.
Making a new copy of the script would fix it or there's some code you can override. There's a statement around line 36 that says:
var override = false;
Set that to true to overwrite the saved host and token. There's also a comment (which is mostly unheard of for my code) for the function that explains things.
I am off until January, so I won't be as present in the Community as normal for the next 3 weeks. I'll be without Internet for the next week, so I won't be able to provide any help figuring things out for this semester.
If you figure out why it's miscounting, send me a note with the solution and I'll update the code. I need to update the interface anyway as I've got a new version that asks for the token with a web form so you never have to edit the script directly. Just finding time to get everything done is the hard part.
After manually going through, it looks like the script did not count 298 posts that were made for a class of 155 students. It might be a good idea to place a warning next to the script or alert those you know are using it that there are potential issues with the script. Since I already have issued grades based off of the script counts, I am now faced with having to redo my curve and reevaluate grades. Hopefully, with the warning, this can be avoided for other faculty.
I am wondering if it might be an issue with some of my forums having so many posts in them that they go on to a "page 2" and when this script is counting the posts, it doesn't have a command to continue on to any additional pages that might exist? Just a thought.
Any scripts I write are provided as-is and without any warranty as to suitability or correctness. They are a "it works for me and you might benefit from it" production. I throw them out there hoping that people will be inspired by them to take them and improve on them. I personally don't use most of the scripts that I make available here in the Community.
If people report problems, I will try to fix them if I can (which is not always possible), but I have no idea who is using it unless they write something. Beyond that, if you read the original reply, you will see that there are tons of warnings about it may not work for you. I will clarify that my issues with pagination are not the same as yours, I was talking about the API returning results in paginated form, not the pagination you might see when there are a LOT of responses.
My offer still holds -- if you track down the problem and fix the code so it works, I will modify the version available for people to download.
As I mentioned, though, it is not always possible to fix them. I've had a couple of cases I've been involved in where Canvas fails to return all of the information when requested through the API. There's nothing my program can do if the information is missing in the first place. I'm not saying that's the problem and I really don't think it is based on the way this particular API call is supposed to work, but you might look at your discussions where posts weren't counted and see if the non-counted posts appear spread throughout the discussion or if they appear on the second page. If they appear spread throughout the discussion, then the probability that Canvas isn't returning all of the discussion just went way up. If they all appear on the second page of the discussion then that gives me a different area to pursue.
As far as not being able to change your grades, I make it clear at the beginning of the semester (and place it into the syllabus) that grades are subject to audit and change and that students should not shoot for the minimum grade needed because I may find a mistake and they may not end up with enough points.
I spent most of Christmas Day investigating and I think I found the issue. Can you check and see the following matches what you're seeing?
The system was only checking one level of threading. That is, it was counting initial posts and replies to initial posts, but not replies to replies to initial posts (or further down the list). In my class this summer, there was no deeper nesting and so I didn't notice that I needed to use recursion.
I've done a major rewrite of the code and changed it to use pivot tables instead of manually do the counting. Unfortunately, generating a pivot table through programming seems problematic, but as long as people don't delete the existing one, it seems to work. It's also cool to see it run. With the pivot table, you can choose whether or not to include teachers and concluded enrollments through a filter, so one spreadsheet allows for configuration to meet people's needs.
I also incorporated the new interface so you don't have to go in and edit the source code anymore. I want to make another modification so that you enter the course ID rather than putting it in a spreadsheet cell. There's also some more testing I want to do before I release it.