Using a script to surface draft assignment grades - Javascript question

Scott.H.223
Scott.H.223 Posts: 8 Analytics Builder Transition
edited November 4 in Higher Ed / Postsecondary

Our institution have been using the following script Steve Bentley posted back in 2019

https://community.brightspace.com/s/article/Developer-Spotlight-Using-a-script-to-surface-draft-assignment-grades

Recently I've been looking to modify the script but my Javascript knowledge is basically non existent so I'm not even sure if what I want to do is even possible.

At the moment the report will only display a list of the users who have submitted to an assignment box. Is there anything I can add or do to the code so that it shows me a list of all students who are eligible to submit to the assignment box or is the API call only able to return data when a student has submitted something?

I want the table to list all users, whether they have submitted or not and still show the information about their draft marks if they have been marked.

I've attempted to email Steve Bentley directly a couple of times this year but had no response so hoping the community may be able to help in his absence.

Thanks in advance

Scott

Answers

  • @Scott.H.223,

    If you take a look at the HTML in the main index file for the resource you linked, you'd see that the way this page works is based on 3 API calls:

    Currently the logic within the JavaScript is to utilize those API calls in order, so that you get the list of Assignments, to get the submissions in each Assignment, and then display user details for each of the submissions in each of the Assignments. The last step is likely where your problem lies.

    I didn't do a deep deep dive on the code to note exactly where that last step is happening to populate the list of users, but I think the switch on line 177 is a good place to start as it does categorize those without submissions.

    Hope that helps!

    -Johnny
    D2L LAM

  • Scott.H.223
    Scott.H.223 Posts: 8 Analytics Builder Transition

    @Johnny.B.962

    I thought the code from line 177 to 261 might have something to do with it but I don't understand enough about Javascript to fully understand what is going on.

    I fumbled around with the code for a while trying things out with the 0 status but everything I did just ended up breaking the code and displaying nothing.

    I also realised the evalurl on line 205 was also incorrect now but couldn't find reference to it in the API documentation.

    Unless I'm missing something, there doesn't seem to be an API call that displays non-submissions to a box. Just the GET submissions that this script uses.

  • Scott,

    That section of code is what is generating the table, so that would be where you want to modify. 205 isn't an API call, it's just trying to generate a URL that links directly to the evaluation page within the Assignment for a given user, but based on some more recent changes to how the URL is generated for that page, the current version no longer works and I'm not sure it will work to do a similar method will work anymore.

    Like I said in the last message, the data is there, just the logic used to display users is in contrast to what you want it to do. Currently, the code appears to be:

    1. Get a list of the Assignments
    2. Get a list of the Submissions in the Assignments
    3. Get the Classlist to match user details to the submissions

    What you want it to do is the following:

    1. Get the Classlist
    2. Get a list of the Assignments
    3. Get a list of Submissions in Assignments to match to the users which have them

    What were you finding in this resource was more useful than just using the Assignments tool directly?

    -Johnny
    D2L LAM

  • Scott.H.223
    Scott.H.223 Posts: 8 Analytics Builder Transition

    @Johnny.B.962

    We've modified the script for the anonymous submission boxes so that it also displays the users org defined ID.

    There isn't a report in the Brightspace data sets that links a students anonymous user number to their org defined ID so we thought we could hack this script to do it for us. Only problem is it currently only shows students who have submitted. We want to see all of the students because we want to advise our teaching staff, who obviously can't see the student names, which of the students who haven't submitted yet are genuine non submissions and which students have been given an extension.

    At the moment our admin staff are having to do this manually on some quite large cohorts (600+) and it's taking a lot of time. This report would allow us to export the full list as a csv and then using a vlookup, match the students we know have extensions with their anonymous user numbers, leaving the students who genuinely haven't submitted so we can contact them about their lack of engagement with the assignment.