From de8ed98b4c43c2486d72eb6b5a9301f42d2a61d6 Mon Sep 17 00:00:00 2001 From: vin Date: Thu, 11 Jan 2024 18:36:22 -0500 Subject: [PATCH] start working on submitting course without user-provided course code --- aplus.go | 28 +++++++++++++++++++++++++++- canvas.go | 10 ++++++++-- main.go | 9 ++++----- 3 files changed, 39 insertions(+), 8 deletions(-) diff --git a/aplus.go b/aplus.go index dfc73e1..29d5033 100644 --- a/aplus.go +++ b/aplus.go @@ -11,17 +11,27 @@ import ( "strings" ) -func submit_code(course_code int, attendance_code string) { +func submit_code(course_code int, attendance_code string) bool { cur_body := launch_aplus(course_code) if verbose { fmt.Printf("%s", cur_body) } + if strings.Contains(cur_body, "Student not known") { + fmt.Println("Student not known. This course must first be visited by an instructor for students to have access.") + return false + } + current_url := fmt.Sprintf("%s/student/", base_aplus_link) // the links to submit the code for a class is under the dayPanel div daypanel_start := strings.Index(cur_body, "