diff options
Diffstat (limited to 'aplus.go')
| -rw-r--r-- | aplus.go | 8 |
1 files changed, 5 insertions, 3 deletions
| @@ -7,12 +7,14 @@ import ( | |||
| 7 | "io" | 7 | "io" |
| 8 | "net/http" | 8 | "net/http" |
| 9 | "net/url" | 9 | "net/url" |
| 10 | "os" | ||
| 11 | "strings" | 10 | "strings" |
| 12 | ) | 11 | ) |
| 13 | 12 | ||
| 14 | func submit_code(course_code int, attendance_code string) bool { | 13 | func submit_code(course_code int, attendance_code string) bool { |
| 15 | cur_body := launch_aplus(course_code) | 14 | cur_body := launch_aplus(course_code) |
| 15 | if cur_body == "" { | ||
| 16 | return false | ||
| 17 | } | ||
| 16 | 18 | ||
| 17 | if verbose { | 19 | if verbose { |
| 18 | fmt.Printf("%s", cur_body) | 20 | fmt.Printf("%s", cur_body) |
| @@ -81,7 +83,7 @@ func launch_aplus(course_code int) string { | |||
| 81 | if err != nil { | 83 | if err != nil { |
| 82 | fmt.Println("Failed to get A+ base URL and tool ID. Try again with a different course code.") | 84 | fmt.Println("Failed to get A+ base URL and tool ID. Try again with a different course code.") |
| 83 | fmt.Printf("Error: %s\n", err) | 85 | fmt.Printf("Error: %s\n", err) |
| 84 | os.Exit(1) | 86 | return "" |
| 85 | } | 87 | } |
| 86 | 88 | ||
| 87 | aplus_link := fmt.Sprintf("%s/courses/%d/external_tools/sessionless_launch?id=%d&access_token=%s", | 89 | aplus_link := fmt.Sprintf("%s/courses/%d/external_tools/sessionless_launch?id=%d&access_token=%s", |
| @@ -172,5 +174,5 @@ func submit_code_sans_course(attendance_code string) { | |||
| 172 | } | 174 | } |
| 173 | } | 175 | } |
| 174 | 176 | ||
| 175 | fmt.Println("Could not submit code %s to any course\n", attendance_code) | 177 | fmt.Println("Could not submit code", attendance_code, "to any course") |
| 176 | } | 178 | } |
