@peeksas ,
The answer is yes, it can do this, but you need to make API calls to do it.
You start off with a list of the discussion topics and then iterate through each one of those, obtaining the entries for each one. Every post by a student appears there and so you just count how many times each student posted.
I've been working on a Google Spreadsheet for another project that Deactivated user asked about in Up for a challenge? Grade Distribution Spreadsheet, but became too busy with the conclusion of my summer course. Now that classes are over, I took a little time this morning and got it working enough to do what you asked for.
To use it, do the following:
- Make sure you're logged into Google Drive and then open the spreadsheet Discussion Counts - Google Sheets
- Go to File and choose Make a Copy. Name it whatever you like.
- In cell A1 enter the Canvas Course ID for the course you want to count the discussions for.
- In cell A2 tell it whether or not to also include completed students (this does not included deleted students, just concluded ones)
- Go to Tools > Script editor
- In the canvasAPI.gs file, find the userConfiguration() function and enter your Canvas hostname and your Access Token. If you don't have an access token, then see How do I obtain an API access token for my account? These will get stored in the Google userProperties(), which is specific to this spreadsheet and your user. After running the program once, you can delete the credentials and not have to worry about someone else copying your file.
- Switch over to the discussionCounts.gs script and then click the Run triangle. Tell Google you authorize it to access your spreadsheet and to make external calls.
- Go back to your spreadsheet and look for a new sheet called "Data" that has your counts in a pivot-table style format.
- If there are any problems, go back to the Script editor and press Ctrl-Enter to see the log file.
You can also watch the video I made that demonstrates this. I've obscured key aspects for privacy and security.
Please accept the cookie policy before viewing this external content.
Now, a few disclaimers.
I've only tested this with my courses, which were small, and not much discussion went on. I think I've allowed for pagination, but you may find there are issues. I use threaded discussions and it's not tested with non-threaded discussions. Your mileage may vary, but it works for me.
Update: It turns out it didn't work for me, but my students didn't participate in the discussions like I had hope so it appeared to work. @kona had me test it on her courses and now it's really working. Pagination issues are fixed and it now returns a correct count on threaded discussions.
I was intending to use this as a framework for other projects because it seems a lot of my responses in the Community are "Yes, you can do that through the API and here's how" and then I write a really technical explanation that may never get implemented. But if there was an easy way to share it, like a Google Spreadsheet, it might encourage people more.
This is, however, my first time sharing code like this and I really have no idea if I did it right or not. I'm also not a Javascript programmer, so I basically spent a lot of time looking at the Google Apps Scripts codes and then the Mozilla javascript documentation. I originally decided I would look at someone else's code and then found it too complicated for me to follow, so I wrote my own from scratch. I didn't do the sums through the spreadsheet, I found them by hand within my code. It definitely could be improved upon, but it's a first attempt. The problem is that I tend to be a perfectionist and so things never get done because they're not perfect. I'm stepping out of my comfort zone here, so hopefully the code works for you.
Only the GET functionality of the API has been tested. It might work, but until I have a need for a POST, PUT, or DELETE, I won't know for sure.
People can do what they would like with the code, but it would be really awesome if someone who did know Javascript or Google Apps wanted to collaborate and improve it. I would like for there to be a single copy of the canvasAPI.gs file that is reasonably up to date and then modify the other script to do the actual processing. The only thing I ask is that you don't sue me if it doesn't work.