Skip to content

Commit

Permalink
Merge CPEx Staging (#3623)) (#3635)
Browse files Browse the repository at this point in the history
* Change MPE to CPE and Open MPE (#3623) (#3627)

Prepare for CPEx open

* Fix serverless function error 500 in vercel (#3623) (#3628)

* Fix serverless function not working (#3623)

* Change modules to courses (#3623) (#3629)

* Change modules to courses (#3623)

* Change inS1 and inS2 MPE to CPEx and fix private key parsing (#3632)

* chore(deps): update dependency postcss to v8.4.31 [security] (#3630)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* feat(cpex): add standalone scraper (#3622)

* chore(cpex): set term to next term instead of current (#3631)

* Change MPE to CPE and Open MPE (#3623)

* Fix serverless function not working (#3623)

* Change modules to courses (#3623)

* Change inS1 and inS2 from mpe to cpex and fix private key parsing (#3623)

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Christopher Goh <chrisgzf@gmail.com>
Co-authored-by: Ravern Koh <ravernkoh@gmail.com>

* Update nus-auth.ts (#3623)

Remove previous changes

* Try to fix openssl legacy error (#3623)

* chore(deps): update dependency postcss to v8.4.31 [security] (#3630)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* feat(cpex): add standalone scraper (#3622)

* chore(cpex): set term to next term instead of current (#3631)

* Change MPE to CPE and Open MPE (#3623)

* Fix serverless function not working (#3623)

* Change modules to courses (#3623)

* Change inS1 and inS2 from mpe to cpex and fix private key parsing (#3623)

* Change package.json to use openssl legacy (#3623)

Change package.json to set env variable(#3623)

* Remove nodeoptions from package.json and change mpe api link (#3623)

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Christopher Goh <chrisgzf@gmail.com>
Co-authored-by: Ravern Koh <ravernkoh@gmail.com>

* Update ModuleForm.tsx to use CPEx (#3623)

* Update FAQ to point to CPEx FAQ (#3623)

* Regenerate yarn lockfile using yarn classic v1

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Christopher Goh <chrisgzf@gmail.com>
Co-authored-by: Ravern Koh <ravernkoh@gmail.com>
  • Loading branch information
4 people committed Oct 14, 2023
1 parent 4399b82 commit 6bbae12
Show file tree
Hide file tree
Showing 17 changed files with 136 additions and 86 deletions.
4 changes: 2 additions & 2 deletions scrapers/nus-v2/src/tasks/CollateModules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,8 @@ const getModuleMPEParticipation = ({
title,
moduleCode,
moduleCredit,
inS1MPE: attributes?.mpes1,
inS2MPE: attributes?.mpes2,
inS1CPEx: attributes?.mpes1,
inS2CPEx: attributes?.mpes2,
});

// Avoid using _.pick here because it is not type safe
Expand Down
4 changes: 2 additions & 2 deletions scrapers/nus-v2/src/types/mpe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ export type MPEModule = Readonly<{
title: ModuleTitle;
moduleCode: ModuleCode;
moduleCredit: string;
inS1MPE?: boolean;
inS2MPE?: boolean;
inS1CPEx?: boolean;
inS2CPEx?: boolean;
}>;
17 changes: 17 additions & 0 deletions website/api/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"compilerOptions":
{
"target": "ES2020",
"module": "commonjs",
"lib": ["ES2020"],
"strict": true,
"noImplicitAny": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"strictBindCallApply": true,
"strictPropertyInitialization": true,
"noImplicitThis": true,
"alwaysStrict": true,
"esModuleInterop": true
}
}
2 changes: 1 addition & 1 deletion website/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@
"redux-persist": "6.0.0",
"redux-thunk": "2.4.2",
"reselect": "4.1.8",
"samlify": "2.8.10",
"samlify": "2.7.7",
"searchkit": "2.4.1-alpha.5",
"use-subscription": "1.8.0"
},
Expand Down
2 changes: 1 addition & 1 deletion website/src/apis/nusmods.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ class NUSModsApi {
* @returns {string}
*/
static mpeModuleListUrl() {
return `${NUSModsApi.baseUrl('')}mpeModules.json`;
return `${NUSModsApi.baseUrl('')}cpexModules.json`;
}
}

Expand Down
2 changes: 1 addition & 1 deletion website/src/featureFlags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@
export const enableShortUrl = false;

/** Enable Module Planning Exercise */
export const enableMpe = false;
export const enableMpe = true;
2 changes: 1 addition & 1 deletion website/src/serverless/nus-auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const idp = samlify.IdentityProvider({

const sp = samlify.ServiceProvider({
metadata: fs.readFileSync(path.join(__dirname, './sp.xml')),
encPrivateKey: process.env.NUS_EXCHANGE_SP_PRIVATE_KEY,
encPrivateKey: process.env.NUS_EXCHANGE_SP_PRIVATE_KEY?.replace(/\\n/g, '\n'),
});

export const createLoginURL = (relayState = '') => {
Expand Down
4 changes: 2 additions & 2 deletions website/src/types/mpe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ export type MpeModule = {
title: ModuleTitle;
moduleCode: ModuleCode;
moduleCredit: string;
inS1MPE?: boolean;
inS2MPE?: boolean;
inS1CPEx?: boolean;
inS2CPEx?: boolean;
};

interface ModuleTypeInfo {
Expand Down
46 changes: 23 additions & 23 deletions website/src/views/layout/Navtabs.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,17 @@ describe(Navtabs, () => {
make();
if (enableMpe) {
expect(screen.getAllByRole('link').map((elem) => elem.textContent)).toMatchInlineSnapshot(`
Array [
"Today",
"Timetable",
"Modules",
"MPE",
"Venues",
"Settings",
"Contribute",
"Whispers",
]
`);
[
"Today",
"Timetable",
"Courses",
"CPEx",
"Venues",
"Settings",
"Contribute",
"Whispers",
]
`);
} else {
expect(screen.getAllByRole('link').map((elem) => elem.textContent)).toMatchInlineSnapshot(`
[
Expand All @@ -69,18 +69,18 @@ describe(Navtabs, () => {
make({ settings: { beta: true } });
if (enableMpe) {
expect(screen.getAllByRole('link').map((elem) => elem.textContent)).toMatchInlineSnapshot(`
Array [
"Today",
"Timetable",
"Modules",
"MPE",
"Venues",
"Planner",
"Settings",
"Contribute",
"Whispers",
]
`);
[
"Today",
"Timetable",
"Courses",
"CPEx",
"Venues",
"Planner",
"Settings",
"Contribute",
"Whispers",
]
`);
} else {
expect(screen.getAllByRole('link').map((elem) => elem.textContent)).toMatchInlineSnapshot(`
[
Expand Down
4 changes: 2 additions & 2 deletions website/src/views/layout/Navtabs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ const Navtabs: FC = () => {
<span className={styles.title}>Courses</span>
</NavLink>
{enableMpe && (
<NavLink {...tabProps} to="/mpe">
<NavLink {...tabProps} to="/cpex">
<Target />
<span className={styles.title}>MPE</span>
<span className={styles.title}>CPEx</span>
</NavLink>
)}
<NavLink {...tabProps} to="/venues" onMouseOver={preloadVenues} onFocus={preloadVenues}>
Expand Down
30 changes: 15 additions & 15 deletions website/src/views/mpe/MpeContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,33 +62,33 @@ const MpeContainer: React.FC = () => {

<h4 className={styles.subtitle}>Overview</h4>
<p>
The Module Planning Exercise (MPE) is a project initiated by NUS to better understand
students’ demand for specific modules (as decided by the Module Host Departments) and
The Course Planning Exercise (CPEx) is a project initiated by NUS to better understand
students’ demand for specific courses (as decided by the Course Host Departments) and
facilitate the Departments in their resource and timetable planning.
</p>
{enableMpe ? (
<>
<p>
For this round of exercise, please{' '}
<strong>
indicate the module(s) you would like to read for Semester {MPE_SEMESTER} of AY
{MPE_AY} (maximum of {MAX_MODULES} modules)
indicate the course(s) you would like to read for Semester {MPE_SEMESTER} of AY
{MPE_AY} (maximum of {MAX_MODULES} courses)
</strong>{' '}
and the <strong>type of degree requirement</strong> each module is being used for. Do
note that there are no validation checks for this MPE (i.e. no timetable clash/requisite
checks). Information collected here is <strong>solely for planning purposes </strong>{' '}
and there is no guarantee that you will be allocated the selected modules during the
ModReg Exercise.
and the <strong>type of degree requirement</strong> each course is being used for. Do
note that there are no validation checks for this CPEx (i.e. no timetable
clash/requisite checks). Information collected here is{' '}
<strong>solely for planning purposes </strong> and there is no guarantee that you will
be allocated the selected courses during the CourseReg Exercise.
</p>
<p>The MPE for this round will be from 06 Mar to 10 Mar 2023.</p>
<p>The CPEx for this round will be from 16 Oct to 20 Oct 2023.</p>
<p>
Participation in the MPE will be used as <strong>one of the tie-breakers</strong> during
the ModReg Exercise, in cases where the demand exceeds the available quota and students
have the same Priority Score for a particular module.
Participation in the CPEx will be used as <strong>one of the tie-breakers</strong>{' '}
during the CourseReg Exercise, in cases where the demand exceeds the available quota and
students have the same Priority Score for a particular module.
</p>
<p>
For further questions, please refer to this{' '}
<ExternalLink href="https://www.nus.edu.sg/registrar/docs/info/mpe/MPE-FAQs.pdf">
<ExternalLink href="https://www.nus.edu.sg/registrar/docs/info/cpex/cpex-faqs.pdf">
FAQ
</ExternalLink>{' '}
provided by NUS Registrar's Office.
Expand Down Expand Up @@ -119,7 +119,7 @@ const MpeContainer: React.FC = () => {
) : (
<>
<hr />
<div>MPE is not open.</div>
<div>CPEx is not open.</div>
</>
)}
</div>
Expand Down
2 changes: 1 addition & 1 deletion website/src/views/mpe/constants.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export const MAX_MODULES = 7;
export const MPE_SEMESTER: 1 | 2 = 1;
export const MPE_SEMESTER: 1 | 2 = 2;
export const MPE_AY = '2023/2024';
6 changes: 3 additions & 3 deletions website/src/views/mpe/form/ModuleForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const ModuleForm: React.FC<Props> = ({

const moduleSelectList = useMemo(() => {
const selectedModules = new Set(preferences.map((preference) => preference.moduleCode));
const semesterProperty = MPE_SEMESTER === 1 ? 'inS1MPE' : 'inS2MPE';
const semesterProperty = MPE_SEMESTER === 1 ? 'inS1CPEx' : 'inS2CPEx';
return mpeModuleList
.filter((module) => module[semesterProperty])
.map((module) => ({
Expand Down Expand Up @@ -178,7 +178,7 @@ const ModuleForm: React.FC<Props> = ({
<div className={styles.rank}>Rank</div>
<div className={styles.module}>Course</div>
<div className={styles.moduleCount}>
{preferences.length} / {MAX_MODULES} Modules Selected
{preferences.length} / {MAX_MODULES} Courses Selected
</div>
</div>
<div>
Expand Down Expand Up @@ -228,7 +228,7 @@ const ModuleForm: React.FC<Props> = ({
</div>
) : (
<p className={styles.maxModulesError}>
Maximum of {MAX_MODULES} modules selected. Remove a module from the list to add more.
Maximum of {MAX_MODULES} courses selected. Remove a course from the list to add more.
</p>
)}
{status}
Expand Down
4 changes: 2 additions & 2 deletions website/src/views/mpe/form/ModulesSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ export class ModulesSelectComponent extends Component<Props, State> {
const showResults = isOpen && results.length > 0;
const showTip = isModalOpen && !results.length;
const showNoResultMessage = isOpen && inputValue && !results.length;
const removeBtnLabel = (moduleCode: ModuleCode) => `Remove ${moduleCode} from MPE preferences`;
const removeBtnLabel = (moduleCode: ModuleCode) => `Remove ${moduleCode} from CPEx preferences`;

return (
<div className={styles.container}>
Expand Down Expand Up @@ -187,7 +187,7 @@ export class ModulesSelectComponent extends Component<Props, State> {
{showTip && (
<div className={styles.tip}>
Try &quot;GER1000&quot; or &quot;Quantitative Reasoning&quot;. Searching{' '}
<strong>{moduleCount}</strong> modules.
<strong>{moduleCount}</strong> courses.
</div>
)}
{showNoResultMessage && (
Expand Down
2 changes: 1 addition & 1 deletion website/src/views/routes/Routes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const Routes: React.FC = () => (
<Route path="/venues/:venue?" component={VenuesContainer} />
<Route path="/today" component={TodayContainer} />
<Route path="/planner" component={PlannerContainer} />
<Route path="/mpe" component={MpeContainer} />
<Route path="/cpex" component={MpeContainer} />
<Route path="/tetris" component={TetrisContainer} />

<Route path="/about" component={AboutContainer} />
Expand Down
6 changes: 6 additions & 0 deletions website/vercel.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
{
"functions": {
"api/**/*.ts": {
"excludeFiles": "./tsconfig.json",
"includeFiles": "./api/tsconfig.json"
}
},
"headers": [
{
"source": "/assets/(.*)",
Expand Down
Loading

2 comments on commit 6bbae12

@vercel
Copy link

@vercel vercel bot commented on 6bbae12 Oct 15, 2023

Choose a reason for hiding this comment

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

Successfully deployed to the following URLs:

nusmods-export – ./export

nusmods-export-git-production-mods-bot.vercel.app
nusmods-export-mods-bot.vercel.app
export.nusmods.com

@vercel
Copy link

@vercel vercel bot commented on 6bbae12 Oct 15, 2023

Choose a reason for hiding this comment

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

Please sign in to comment.