This repository was archived by the owner on Jan 21, 2024. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -33,7 +33,7 @@ export class GuildContext {
3333 * The list of allowed courses that users can be assigned to.
3434 * May be empty if the list could not be populated automatically.
3535 */
36- public courses : { [ majorPrefix : string ] : Course [ ] } ;
36+ public coursesByMajor : { [ majorPrefix : string ] : Course [ ] } ;
3737
3838 public verificationRoleId : string ;
3939
@@ -51,7 +51,7 @@ export class GuildContext {
5151
5252 private async init ( ) : Promise < void > {
5353 this . guildLog ( "Initializing course lists..." ) ;
54- this . courses = await CourseService . fetchCourseList ( this , new WebCatalogFactory ( ) . getWebCatalog ( this . guildConfig . webCatalog ) )
54+ this . coursesByMajor = await CourseService . fetchCourseList ( this , new WebCatalogFactory ( ) . getWebCatalog ( this . guildConfig . webCatalog ) )
5555 . catch ( err => {
5656 this . guildError ( "Failed to get course lists from the web catalog:" , err ) ;
5757
Original file line number Diff line number Diff line change @@ -36,7 +36,7 @@ export class CourseService {
3636 * @returns The course if it could be found in the cache, otherwise null.
3737 */
3838 public static findCourseByKey ( guildContext : GuildContext , key : string ) : Course | null {
39- const allCourses = _ . flatMap ( guildContext . courses ) ;
39+ const allCourses = _ . flatMap ( guildContext . coursesByMajor ) ;
4040 return allCourses . find ( c => c . key == key ) ;
4141 }
4242
@@ -49,7 +49,7 @@ export class CourseService {
4949 * @returns The course if valid, undefined if not.
5050 */
5151 public static async getCourseFromNumber ( guildContext : GuildContext , number : string , major : Major ) : Promise < Course > {
52- const majorCourses = guildContext . courses [ major . prefix ] ;
52+ const majorCourses = guildContext . coursesByMajor [ major . prefix ] ;
5353 if ( majorCourses . length === 0 ) {
5454 return {
5555 key : CourseUtils . getKey ( number , major ) ,
Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ export class DiscordRoleAssignmentService {
2525
2626 // Courses
2727 //TODO: Won't work for non-catalog majors
28- for ( let courses of Object . values ( guildContext . courses ) ) {
28+ for ( let courses of Object . values ( guildContext . coursesByMajor ) ) {
2929 for ( let course of courses ) {
3030 const assignment = user . guilds . get ( guildContext . guild . id ) . courses . find ( courseAssignment => courseAssignment . courseKey === course . key ) ;
3131 if ( assignment ) { // User is assigned to course.
Original file line number Diff line number Diff line change @@ -364,7 +364,9 @@ export class MajorImplementService {
364364 if ( ! guildContext . guild . channels . resolve ( id ) ) {
365365 guildContext . guildLog ( `Removed missing category ID ${ id } from ${ major . prefix } major implement` ) ;
366366 update = true ;
367+ return false ;
367368 }
369+ return true ;
368370 } ) ;
369371 }
370372
You can’t perform that action at this time.
0 commit comments