From 10634c1210f812bb7205ba4a17ec2e1ad311c12b Mon Sep 17 00:00:00 2001 From: Xevion Date: Mon, 29 Jan 2024 14:13:36 -0600 Subject: [PATCH] Spelling, separate Course struct from SearchResults Separating the course struct will be useful for storing classes by CRN later on --- README.md | 1 + api.go | 2 +- term.go | 2 +- types.go | 120 +++++++++++++++++++++++++++--------------------------- 4 files changed, 64 insertions(+), 61 deletions(-) diff --git a/README.md b/README.md index 8e34ad3..c9d8959 100644 --- a/README.md +++ b/README.md @@ -53,6 +53,7 @@ The follow features, JSON, and more require validation & analysis: - AFF vs AIN vs AHB etc. - Do CRNs repeat between years? - Check whether partOfTerm is always filled in, and it's meaning for various class results. +- Check which API calls are affected by change in term/sessionID term select ## Real-time Suggestions diff --git a/api.go b/api.go index fa4aca4..f2dc5bc 100644 --- a/api.go +++ b/api.go @@ -10,7 +10,7 @@ import ( "strconv" "strings" - log "github.com/rs/zerolog/log" + "github.com/rs/zerolog/log" ) var sessionID string = RandomString(5) + Nonce() diff --git a/term.go b/term.go index 2800479..c5ce7a2 100644 --- a/term.go +++ b/term.go @@ -41,7 +41,7 @@ type YearDayRange struct { } // GetYearDayRange returns the start and end day of each term for the given year. -// This could technichally introduce race conditions, but it's more likely confusion from UTC will be a greater issue. +// This could technically introduce race conditions, but it's more likely confusion from UTC will be a greater issue. // Spring: January 14th to May // Summer: May 25th - August 15th // Fall: August 18th - December 10th diff --git a/types.go b/types.go index 5af94de..b499caf 100644 --- a/types.go +++ b/types.go @@ -240,63 +240,65 @@ type SearchResult struct { Config string `json:"config"` Display string `json:"display"` } `json:"searchResultsConfig"` - Data []struct { - // A internal identifier not used outside of the Banner system - Id int `json:"id"` - // The internal identifier for the term this class is in (e.g. 202420) - Term string `json:"term"` - // The human-readable name of the term this class is in (e.g. Fall 2021) - TermDesc string `json:"termDesc"` - // The specific identifier that describes this individual course. CRNs are unique to a term. (TODO: Verify this is true) - CourseReferenceNumber string `json:"courseReferenceNumber"` - PartOfTerm string `json:"partOfTerm"` - CourseNumber string `json:"courseNumber"` - // The short acronym of the course subject (e.g. CS, AEPI) - Subject string `json:"subject"` - // The full name of the course subject (e.g. Computer Science, Academic English Program-Intl.) - SubjectDescription string `json:"subjectDescription"` - // The specific section of the course (e.g. 001, 002) - SequenceNumber string `json:"sequenceNumber"` - // The long name of the campus this course takes place at (e.g. Main Campus, Downtown Campus) - CampusDescription string `json:"campusDescription"` - ScheduleTypeDescription string `json:"scheduleTypeDescription"` - // The long name of the course (generally) - CourseTitle string `json:"courseTitle"` - CreditHours int `json:"creditHours"` - // The maximum number of students that can enroll in this course - MaximumEnrollment int `json:"maximumEnrollment"` - // The number of students currently enrolled in this course - Enrollment int `json:"enrollment"` - // The number of seats available in this course (MaximumEnrollment - Enrollment) - SeatsAvailable int `json:"seatsAvailable"` - // The number of students that could waitlist for this course - WaitCapacity int `json:"waitCapacity"` - // The number of students currently on the waitlist for this course - WaitCount int `json:"waitCount"` - CrossList *string `json:"crossList"` - CrossListCapacity *int `json:"crossListCapacity"` - CrossListCount *int `json:"crossListCount"` - CrossListAvailable *int `json:"crossListAvailable"` - CreditHourHigh *int `json:"creditHourHigh"` - CreditHourLow *int `json:"creditHourLow"` - CreditHourIndicator *string `json:"creditHourIndicator"` - OpenSection bool `json:"openSection"` - LinkIdentifier *string `json:"linkIdentifier"` - IsSectionLinked bool `json:"isSectionLinked"` - // A combination of the subject and course number (e.g. subject=CS, courseNumber=3443 => "CS3443") - SubjectCourse string `json:"subjectCourse"` - ReservedSeatSummary *string `json:"reservedSeatSummary"` - InstructionalMethod string `json:"instructionalMethod"` - InstructionalMethodDescription string `json:"instructionalMethodDescription"` - SectionAttributes []struct { - Class string `json:"class"` - Code string `json:"code"` - CourseReferenceNumber string `json:"courseReferenceNumber"` - Description string `json:"description"` - IsZtcAttribute bool `json:"isZTCAttribute"` - TermCode string `json:"termCode"` - } `json:"sectionAttributes"` - Faculty []FacultyItem `json:"faculty"` - MeetingsFaculty []MeetingTimeResponse `json:"meetingsFaculty"` - } `json:"data"` + Data []Course `json:"data"` +} + +type Course struct { + // A internal identifier not used outside of the Banner system + Id int `json:"id"` + // The internal identifier for the term this class is in (e.g. 202420) + Term string `json:"term"` + // The human-readable name of the term this class is in (e.g. Fall 2021) + TermDesc string `json:"termDesc"` + // The specific identifier that describes this individual course. CRNs are unique to a term. (TODO: Verify this is true) + CourseReferenceNumber string `json:"courseReferenceNumber"` + PartOfTerm string `json:"partOfTerm"` + CourseNumber string `json:"courseNumber"` + // The short acronym of the course subject (e.g. CS, AEPI) + Subject string `json:"subject"` + // The full name of the course subject (e.g. Computer Science, Academic English Program-Intl.) + SubjectDescription string `json:"subjectDescription"` + // The specific section of the course (e.g. 001, 002) + SequenceNumber string `json:"sequenceNumber"` + // The long name of the campus this course takes place at (e.g. Main Campus, Downtown Campus) + CampusDescription string `json:"campusDescription"` + ScheduleTypeDescription string `json:"scheduleTypeDescription"` + // The long name of the course (generally) + CourseTitle string `json:"courseTitle"` + CreditHours int `json:"creditHours"` + // The maximum number of students that can enroll in this course + MaximumEnrollment int `json:"maximumEnrollment"` + // The number of students currently enrolled in this course + Enrollment int `json:"enrollment"` + // The number of seats available in this course (MaximumEnrollment - Enrollment) + SeatsAvailable int `json:"seatsAvailable"` + // The number of students that could waitlist for this course + WaitCapacity int `json:"waitCapacity"` + // The number of students currently on the waitlist for this course + WaitCount int `json:"waitCount"` + CrossList *string `json:"crossList"` + CrossListCapacity *int `json:"crossListCapacity"` + CrossListCount *int `json:"crossListCount"` + CrossListAvailable *int `json:"crossListAvailable"` + CreditHourHigh *int `json:"creditHourHigh"` + CreditHourLow *int `json:"creditHourLow"` + CreditHourIndicator *string `json:"creditHourIndicator"` + OpenSection bool `json:"openSection"` + LinkIdentifier *string `json:"linkIdentifier"` + IsSectionLinked bool `json:"isSectionLinked"` + // A combination of the subject and course number (e.g. subject=CS, courseNumber=3443 => "CS3443") + SubjectCourse string `json:"subjectCourse"` + ReservedSeatSummary *string `json:"reservedSeatSummary"` + InstructionalMethod string `json:"instructionalMethod"` + InstructionalMethodDescription string `json:"instructionalMethodDescription"` + SectionAttributes []struct { + Class string `json:"class"` + Code string `json:"code"` + CourseReferenceNumber string `json:"courseReferenceNumber"` + Description string `json:"description"` + IsZtcAttribute bool `json:"isZTCAttribute"` + TermCode string `json:"termCode"` + } `json:"sectionAttributes"` + Faculty []FacultyItem `json:"faculty"` + MeetingsFaculty []MeetingTimeResponse `json:"meetingsFaculty"` }