summaryrefslogtreecommitdiff
path: root/aplus.go
diff options
context:
space:
mode:
authorvin <git@vineetk.net>2024-01-12 17:22:35 -0500
committervin <git@vineetk.net>2024-01-12 17:24:09 -0500
commitcbcc7631a4df81682db46fd6ea7f581f13cb21ea (patch)
treeb18c8bd1c1a1358bbd0b2e05776f492323e627ba /aplus.go
parent1179315d30b3c9bb5962961c158c325ba1eb3243 (diff)
send attendance code to all current courses when course not specified
Diffstat (limited to 'aplus.go')
-rw-r--r--aplus.go8
1 files changed, 5 insertions, 3 deletions
diff --git a/aplus.go b/aplus.go
index 29d5033..2e2ab0a 100644
--- a/aplus.go
+++ b/aplus.go
@@ -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
14func submit_code(course_code int, attendance_code string) bool { 13func 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}