-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: some instructors teaching wrong course (#208)
- Loading branch information
Showing
20 changed files
with
515 additions
and
255 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?php | ||
|
||
namespace App\Contracts; | ||
|
||
interface CourseInterface { | ||
public function getSubject(): string; // "HIST" | ||
public function getCatalogNumber(): string; // "1001W" | ||
public function getTitle(): string; // "History of the World" | ||
public function getCourseCode(): string; // "HIST-1001W" | ||
public function getCourseType(): string; // "LEC" | ||
public function getCourseLevel(): string; // "UGRD" | ||
public function getSource(): string; // "local" or "sis" | ||
public function getApiId(): string; // "HIST-1001W" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?php | ||
|
||
namespace App\Contracts; | ||
|
||
interface CourseSectionInterface { | ||
public function getApiId(): string; | ||
public function getCourseApiId(): string; | ||
public function getDBId(): int | null; | ||
public function getTermId(): int; | ||
public function getClassSection(): string; | ||
public function getEnrollmentCap(): int; | ||
public function getEnrollmentTotal(): int; | ||
public function getWaitlistCap(): int; | ||
public function getWaitlistTotal(): int; | ||
public function isCancelled(): bool; | ||
public function isPublished(): bool; | ||
public function getSource(): string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?php | ||
|
||
namespace App\Contracts; | ||
|
||
interface EnrollmentInterface { | ||
public function getApiId(): string; | ||
public function getDBId(): int | null; | ||
public function getEmplid(): int; | ||
public function getSectionApiId(): string; | ||
public function getSectionDBId(): int | null; | ||
public function getRole(): string; | ||
public function getSource(): string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
<?php | ||
|
||
namespace App\DTOs; | ||
|
||
use App\Contracts\CourseInterface; | ||
|
||
class SISCourseDTO implements CourseInterface { | ||
|
||
public string $SUBJECT; | ||
public string $CATALOG_NUMBER; | ||
public string $DESCRIPTION; | ||
public string $COMPONENT_CLASS; | ||
public string $ACADEMIC_CAREER; | ||
|
||
/** | ||
* create a new SISCourseDTO instance. | ||
* | ||
* @param object{ | ||
* SUBJECT: string, | ||
* CATALOG_NUMBER: string, | ||
* DESCRIPTION: string, | ||
* COMPONENT_CLASS: string, | ||
* ACADEMIC_CAREER: string, | ||
* } $course An associative array with course data. | ||
*/ | ||
public function __construct($course) { | ||
$this->SUBJECT = $course->SUBJECT; | ||
$this->CATALOG_NUMBER = $course->CATALOG_NUMBER; | ||
$this->DESCRIPTION = $course->DESCRIPTION; | ||
$this->COMPONENT_CLASS = $course->COMPONENT_CLASS ?? 'Unknown'; | ||
$this->ACADEMIC_CAREER = $course->ACADEMIC_CAREER; | ||
} | ||
|
||
public function getSubject(): string | ||
{ | ||
return $this->SUBJECT; | ||
} | ||
|
||
public function getCatalogNumber(): string | ||
{ | ||
return $this->CATALOG_NUMBER; | ||
} | ||
|
||
public function getTitle(): string | ||
{ | ||
return $this->DESCRIPTION; | ||
} | ||
|
||
public function getCourseCode(): string | ||
{ | ||
return $this->SUBJECT . '-' . $this->CATALOG_NUMBER; | ||
} | ||
|
||
public function getCourseType(): string | ||
{ | ||
return $this->COMPONENT_CLASS; | ||
} | ||
|
||
public function getCourseLevel(): string | ||
{ | ||
return $this->ACADEMIC_CAREER; | ||
} | ||
|
||
public function getSource(): string | ||
{ | ||
return 'sis'; | ||
} | ||
|
||
public function getApiId(): string | ||
{ | ||
return $this->getCourseCode(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
<?php | ||
|
||
namespace App\DTOs; | ||
|
||
use App\Contracts\CourseInterface; | ||
use App\Contracts\CourseSectionInterface; | ||
|
||
class SISCourseSectionDTO implements CourseSectionInterface { | ||
private SISCourseDTO $course; | ||
private int $termId; | ||
private string $classSection; | ||
private int $enrollmentCap; | ||
private int $enrollmentTotal; | ||
private int $waitlistCap; | ||
private int $waitlistTotal; | ||
private bool $isCancelled; | ||
private bool $isPublished; | ||
|
||
/** | ||
* | ||
* @param object{ | ||
* id: int, | ||
* TERM: int, | ||
* INSTRUCTOR_EMPLID: int, | ||
* ACADEMIC_ORG: int, | ||
* SUBJECT: string, | ||
* CLASS_SECTION: string, | ||
* INSTRUCTOR_ROLE: string, | ||
* CATALOG_NUMBER: string, | ||
* CLASS_NUMBER: int, | ||
* ACADEMIC_CAREER: string, | ||
* DESCRIPTION: string, | ||
* COMPONENT_CLASS: string, | ||
* ENROLLMENT_CAP: int, | ||
* ENROLLMENT_TOTAL: int, | ||
* WAITLIST_CAP: int, | ||
* WAITLIST_TOTAL: int, | ||
* CANCELLED: int, | ||
* ENROLLMENTS: array | ||
* } $rawClassData - The raw class data from the SIS | ||
* @return void | ||
*/ | ||
public function __construct($rawClassData) { | ||
$this->course = new SISCourseDTO($rawClassData); | ||
$this->termId = $rawClassData->TERM; | ||
$this->classSection = $rawClassData->CLASS_SECTION; | ||
$this->enrollmentCap = $rawClassData->ENROLLMENT_CAP; | ||
$this->enrollmentTotal = $rawClassData->ENROLLMENT_TOTAL; | ||
$this->waitlistCap = $rawClassData->WAITLIST_CAP; | ||
$this->waitlistTotal = $rawClassData->WAITLIST_TOTAL; | ||
$this->isCancelled = $rawClassData->CANCELLED === 1; | ||
$this->isPublished = true; | ||
} | ||
|
||
public function getApiId(): string { | ||
return join('-',[ | ||
$this->course->getApiId(), | ||
$this->classSection, | ||
$this->termId | ||
]); | ||
} | ||
|
||
public function getDBId(): int | null { | ||
// not stored in the local db | ||
return null; | ||
} | ||
|
||
public function getTermId(): int { | ||
return $this->termId; | ||
} | ||
|
||
public function getClassSection(): string | ||
{ | ||
return $this->classSection; | ||
} | ||
|
||
public function getEnrollmentCap(): int | ||
{ | ||
return $this->enrollmentCap; | ||
} | ||
|
||
public function getEnrollmentTotal(): int | ||
{ | ||
return $this->enrollmentTotal; | ||
} | ||
|
||
public function getWaitlistCap(): int | ||
{ | ||
return $this->waitlistCap; | ||
} | ||
|
||
public function getWaitlistTotal(): int | ||
{ | ||
return $this->waitlistTotal; | ||
} | ||
|
||
public function isCancelled(): bool | ||
{ | ||
return $this->isCancelled; | ||
} | ||
|
||
public function isPublished(): bool | ||
{ | ||
return $this->isPublished; | ||
} | ||
|
||
public function getCourseApiId(): string | ||
{ | ||
return $this->course->getApiId(); | ||
} | ||
|
||
public function getSource(): string | ||
{ | ||
return 'sis'; | ||
} | ||
} |
Oops, something went wrong.