github / gh-classroom

GitHub Classroom CLI Extension is a powerful and easy-to-use command line tool that enhances the functionality of the GitHub CLI, specifically tailored for educators using GitHub Classroom.
MIT License
82 stars 14 forks source link

Add assignment grades CSV download command #28

Closed zrdaley closed 1 year ago

zrdaley commented 1 year ago

Fixes https://github.com/github/gh-classroom/issues/5

This command will be available for use with the following flags:

gh classroom assignment-grades -a 4876 -f $download-file-path

Pre-requisites:

Previous implementation: https://github.com/github/gh-classroom/pull/22

zrdaley commented 1 year ago

I was able to confirm that the command is working in my codespace.

Grades exist case

@zrdaley ➜ /workspaces/gh-classroom (zrdaley/assignment_grades) $ go run main.go assignment-grades
? Select a classroom: zrdaleytestorg-classroom-02aa72
? Select an assignment: test
@zrdaley ➜ /workspaces/gh-classroom (zrdaley/assignment_grades) $ cat grades.csv 
assignment_name,assignment_url,starter_code_url,github_username,roster_identifier,student_repository_name,student_repository_url,submission_timestamp,points_awarded,points_available
test,https://classroom.github.com/classrooms/126513340-zrdaleytestorg-classroom-02aa72/assignments/test,,zrdaley,,test-zrdaley,https://github.com/zrdaleytestorg/test-zrdaley,,0,0

^ This was the same as the CSV exported through the UI.

zrdaley@Zenaras-MBP Desktop % cat test-grades-1692821024.csv 
"assignment_name","assignment_url","starter_code_url","github_username","roster_identifier","student_repository_name","student_repository_url","submission_timestamp","points_awarded","points_available"
"test","https://classroom.github.com/classrooms/126513340-zrdaleytestorg-classroom-02aa72/assignments/test","","zrdaley","","test-zrdaley","https://github.com/zrdaleytestorg/test-zrdaley","","0","0"

Both files open in the Numbers mac app.

No grades exist case:

@zrdaley ➜ /workspaces/gh-classroom (zrdaley/assignment_grades) $ go run main.go assignment-grades
? Select a classroom: zrdaleytestorg-classroom-02aa72
? Select an assignment: test
2023/08/23 19:53:39 No grades were returned for assignment
exit status 1