seas-computing / course-planner

SEAS Course Planning Application. JSDoc Docs at: https://seas-computing.github.io/course-planner/
0 stars 1 forks source link

SameAs Functionality in Course Entities #592

Closed jonseitz closed 1 year ago

jonseitz commented 1 year ago

This should the final blocking feature for deployment of the Course Planner. It does require a potentially destructive database schema change, so I'm marking it as breaking -- after merge we can also increment our minor version number.

This replaces the previous free text sameAs field in our Course schema with a self-referential foreign key that associates any course with any other "parent" course. It also modifies the existing views and queries to:

  1. Substitute the parent course's instances for its own in the Courses Page
  2. List all related courses (children, parents, and siblings) in the "Same As" field on the courses page.

I did tweak the put and post endpoints to treat the sameAs field as the UUID for the parent course when creating or updating a course, in order to resolve TypeScript conflicts. However, this change has not been reflected in the UI yet, so there is no user-facing way to set the sameAs course for the time being. For that reason I've held off on testing those endpoints until we have a full workflow in place.

There is related work on the ETL repo that will migrate the relationships from the old course-planner system. Running that will require pulling down the entities from this branch, which can be done by changing the following in package.json:

diff --git a/package.json b/package.json
index 6786852..dd21684 100644
--- a/package.json
+++ b/package.json
@@ -4,7 +4,7 @@
   "description": "",
   "main": "index.js",
   "scripts": {
-    "prestart": "./get-entities.sh",
+    "prestart": "./get-entities.sh -b feature/388-sameas-functionality",
     "postinstall": "./get-entities.sh",
     "start": "ts-node -r dotenv/config -r tsconfig-paths/register src/index.ts",
     "lint": "eslint --ext=ts ./src",

Types of changes

Checklist:

Priority:

Related Issues:

Fixes #388

codecov[bot] commented 1 year ago

Codecov Report

Merging #592 (0d503cd) into develop (c1c9d14) will decrease coverage by 0.13%. The diff coverage is 90.00%.

@@             Coverage Diff             @@
##           develop     #592      +/-   ##
===========================================
- Coverage    95.44%   95.30%   -0.14%     
===========================================
  Files          191      191              
  Lines         4632     4453     -179     
  Branches       581      536      -45     
===========================================
- Hits          4421     4244     -177     
+ Misses         104      100       -4     
- Partials       107      109       +2     
Impacted Files Coverage Δ
...rc/client/components/pages/Courses/CourseModal.tsx 87.73% <0.00%> (-0.84%) :arrow_down:
...rc/client/components/pages/Courses/modalFields.tsx 100.00% <ø> (ø)
...rc/client/components/pages/Courses/tableFields.tsx 92.66% <ø> (-1.76%) :arrow_down:
src/common/constants/columns.ts 100.00% <ø> (ø)
src/common/dto/courses/CreateCourse.dto.ts 100.00% <ø> (ø)
src/common/dto/courses/UpdateCourse.dto.ts 100.00% <ø> (ø)
src/server/course/course.controller.ts 87.75% <0.00%> (-12.25%) :arrow_down:
src/server/course/course.service.ts 100.00% <ø> (ø)
...rc/server/courseInstance/courseInstance.service.ts 96.87% <ø> (ø)
.../components/pages/Faculty/FacultyScheduleTable.tsx 100.00% <100.00%> (ø)
... and 7 more

:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more