Fix the bug of get_course_members does not work when num_submissions_column is not 3 or 4#48
Conversation
…erate through the header text and search for startswith('submissions')
|
Hey, sorry for not getting back sooner. Are you still interested in contributing? I'd be happy to review. |
|
Oops, I deleted the branch by mistake. Didn't realize that would close the pull request. Restoring and re-opening the branch now. |
calvinatian
left a comment
There was a problem hiding this comment.
Thanks for reporting an opening a PR! Sorry again for the slow response. I have a suggestion for searching to ideally remove the dependency on English..
Unfortunately the CI testing relies on GH secrets which don't propagate to forks. But, the changes seem fine to me so we can ignore them for this PR.
| num_submissions_column = -1 | ||
| for i, h in enumerate(headers): | ||
| if h.text.lower().startswith("submissions"): | ||
| num_submissions_column = i | ||
| break |
There was a problem hiding this comment.
Thinking about this some more I think we could do a search for the Edit column and take the previous element as the Submissions column. I think the edit column has a unique aria-label. This way we can remove the language dependency on the English "Sections"/"Submissions" wording.
Another option could be searching the headers for the aria-controls="DataTables_Table_0" attribute and taking the last one as the submissions column.
Summary
Fix the problem of get_course_members does not work when num_submissions_column is not 3 or 4. Example failure case gradescope screenshot is shown below (the first & last name swap count as 2 columns):

Details
Instead of hard code num_submissions_column to 3 or 4, in get_course_members, I changed to iterate through the header text and search for text that starts with "submissions" to obtain num_submissions_column
Checks
Team to Review
Anyone
Reference to the issue
I didn't crate one and I don't see one in issues that match.