Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

### ✨ New features/enhancements

- Added recommended preparation field to courses and updated the course info modal

### 🐛 Bug fixes

- Fixed CSS styling of background colour and let the application have full height
Expand Down
1 change: 1 addition & 0 deletions app/Database/Tables.hs
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ Course
title T.Text Maybe
description T.Text Maybe
prereqs T.Text Maybe
prep T.Text Maybe
exclusions T.Text Maybe
breadth BreadthId Maybe
distribution DistributionId Maybe
Expand Down
3 changes: 3 additions & 0 deletions app/Models/Course.hs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ import Database.Tables (
courseDescription,
courseDistribution,
courseExclusions,
coursePrep,
coursePrereqString,
courseTitle,
courseVideoUrls
Expand All @@ -63,6 +64,7 @@ data CourseData
, prereqString :: Maybe T.Text
, allMeetingTimes :: Maybe [MeetTime']
, name :: !T.Text
, prep :: Maybe T.Text
, exclusions :: Maybe T.Text
, distribution :: Maybe T.Text
, coreqs :: Maybe T.Text
Expand Down Expand Up @@ -118,6 +120,7 @@ buildCourse allMeetings course = do
(coursePrereqString course)
(Just allMeetings)
(courseCode course)
(coursePrep course)
(courseExclusions course)
cDistribution
(courseCoreqs course)
Expand Down
4 changes: 2 additions & 2 deletions app/WebParsing/ArtSciParser.hs
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,7 @@ parseCourses tags =
description = maybe "" ((courseContents !!) . (+ 1)) i1
prereqString = getValue "Prerequisite:" courseContents
coreq = getValue "Corequisite:" courseContents
-- TODO: add a "recommended preparation" field to the database
-- prep = getValue "Recommended Preparation:" courseContents
prep = getValue "Recommended Preparation:" courseContents
exclusion = getValue "Exclusion:" courseContents
distribution = fromMaybe "" $ getValue "Distribution Requirements:" courseContents
breadth = fromMaybe "" $ getValue "Breadth Requirements:" courseContents
Expand All @@ -143,6 +142,7 @@ parseCourses tags =
(Just title)
(Just description)
(fmap (T.pack . show . parseReqs . T.unpack) prereqString)
prep
exclusion
Nothing
Nothing
Expand Down
21 changes: 14 additions & 7 deletions backend-test/Controllers/CourseControllerTests.hs

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions backend-test/Controllers/GenerateControllerTests.hs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ insertCoursesWithPrerequisites = mapM_ insertCourse
, courseTitle = Nothing
, courseDescription = Nothing
, coursePrereqs = prereqString
, coursePrep = Nothing
, courseExclusions = Nothing
, courseBreadth = Nothing
, courseDistribution = Nothing
Expand Down
1 change: 1 addition & 0 deletions js/components/common/__tests__/CourseModalUpdate.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ describe("componentDidUpdate", () => {
title: "Foundations of Computer Science I",
description: null,
prereqs: null,
prep: null,
exclusions: null,
breadth: null,
distribution: null,
Expand Down
4 changes: 4 additions & 0 deletions js/components/common/__tests__/InfoModalFields.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ describe("Displays course information fields iff they are non-empty.", () => {
description: "test description",
prereqString: ["ABC101H1"],
coreqs: ["DEF101H1"],
prep: ["JKL101H1"],
exclusions: ["GHI101H1"],
distribution: "Sciences",
breadth: "The Physical and Mathematical Universes (5)",
Expand All @@ -20,6 +21,7 @@ describe("Displays course information fields iff they are non-empty.", () => {
await screen.findByText("test description")
await screen.findByText("ABC101H1")
await screen.findByText("DEF101H1")
await screen.findByText("JKL101H1")
await screen.findByText("GHI101H1")
await screen.findByText("Sciences")
await screen.findByText("The Physical and Mathematical Universes (5)")
Expand All @@ -31,6 +33,7 @@ describe("Displays course information fields iff they are non-empty.", () => {
description: "",
prereqString: [],
coreqs: [],
prep: [],
exclusions: [],
distribution: "",
breadth: "",
Expand All @@ -39,6 +42,7 @@ describe("Displays course information fields iff they are non-empty.", () => {
render(<Description course={courseInfo} sessions={{}} />)
expect(screen.queryByText("Prerequisite:")).toBeNull()
expect(screen.queryByText("Corequisite:")).toBeNull()
expect(screen.queryByText("Recommended Preparation:")).toBeNull()
expect(screen.queryByText("Exclusion:")).toBeNull()
expect(screen.queryByText("Distribution Requirement Status:")).toBeNull()
expect(screen.queryByText("Breadth Requirement:")).toBeNull()
Expand Down
7 changes: 7 additions & 0 deletions js/components/common/react_modal.js.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ class CourseModal extends React.Component {
description: this.convertToLink(course.description),
prereqString: this.convertToLink(course.prereqString),
coreqs: this.convertToLink(course.coreq),
prep: this.convertToLink(course.prep),
exclusions: this.convertToLink(course.exclusions),
}

Expand Down Expand Up @@ -374,6 +375,12 @@ class Description extends React.Component {
{this.props.course.coreqs}
</p>
)}
{this.props.course.prep?.length > 0 && (

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the academic calendar "Recommended Preparation" comes after "Exclusion" (but before "Breadth Requirement") and we should follow the same order here

<p>
<strong>Recommended Preparation: </strong>
{this.props.course.prep}
</p>
)}
{this.props.course.exclusions?.length > 0 && (
<p>
<strong>Exclusion: </strong>
Expand Down
1 change: 1 addition & 0 deletions js/components/graph/__mocks__/aaa100-course-info.js
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,7 @@ export default {
videoUrls: [],
breadth: "The Physical and Mathematical Universes (5)",
name: "AAA100H1",
prep: "AAA101H1",
exclusions: "",
title: "Introduction to AAA Thinking",
description:
Expand Down
1 change: 1 addition & 0 deletions js/components/graph/__mocks__/bbb100-course-info.js
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,7 @@ export default {
videoUrls: [],
breadth: "The Physical and Mathematical Universes (5)",
name: "BBB100H1",
prep: "BBB101H1",
exclusions: "",
title: "Introduction to BBB Thinking",
description:
Expand Down
1 change: 1 addition & 0 deletions js/components/graph/__mocks__/ccc100-course-info.js
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,7 @@ export default {
videoUrls: [],
breadth: "The Physical and Mathematical Universes (5)",
name: "CCC100H1",
prep: "CCC101H1",
exclusions: "",
title: "Introduction to CCC Thinking",
description:
Expand Down
1 change: 1 addition & 0 deletions js/components/grid/__tests__/CoursePanel.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ describe("CoursePanel", () => {
title: "Foundations of Computer Science I",
description: null,
prereqs: null,
prep: null,
exclusions: null,
breadth: null,
distribution: null,
Expand Down