Skip to content

Commit 0cf08a5

Browse files
authored
Merge branch 'master' into kagiura/mobility
2 parents 1561da9 + ce120c2 commit 0cf08a5

23 files changed

+177
-50
lines changed

docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ services:
3535
- website
3636
init: true
3737
security_opt:
38-
- seccomp="infra/instance/chromium.seccomp.json"
38+
- seccomp=infra/instance/chromium.seccomp.json
3939
environment:
4040
- NODE_ENV=development
4141
- PORT=8082

website/src/actions/export.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { Module, Semester } from 'types/modules';
1+
import type { Module, ModuleCode, Semester } from 'types/modules';
22
import type { ExportData } from 'types/export';
33
import type { Dispatch, GetState } from 'types/redux';
44
import { hydrateSemTimetableWithLessons } from 'utils/timetables';
@@ -31,11 +31,12 @@ export function downloadAsIcal(semester: Semester) {
3131
.then(([ical, icalUtils]) => {
3232
const state = getState();
3333
const { modules } = state.moduleBank;
34+
const hiddenModules: ModuleCode[] = state.timetables.hidden[semester] || [];
3435

3536
const timetable = getSemesterTimetableLessons(state)(semester);
3637
const timetableWithLessons = hydrateSemTimetableWithLessons(timetable, modules, semester);
3738

38-
const events = icalUtils.default(semester, timetableWithLessons, modules);
39+
const events = icalUtils.default(semester, timetableWithLessons, modules, hiddenModules);
3940
const cal = ical.default({
4041
domain: 'nusmods.com',
4142
prodId: '//NUSMods//NUSMods//EN',

website/src/data/team.json

Lines changed: 42 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@
4545
{
4646
"name": "Li Kai",
4747
"description": "Happy to help. Software Engineer @ Quora, Ex-Front End Engineer Intern @ Facebook",
48-
"active": true,
4948
"link": "https://www.github.com/li-kai",
5049
"gravatar": "3d2bcece0409c7578b2e9d87f0c1b6d7",
5150
"gravatarAlt": "Li Kai",
@@ -76,7 +75,6 @@
7675
{
7776
"name": "Zhang Yi Jiang",
7877
"description": "Fan of pretty purple pony princesses. Software Engineer @ Ironclad",
79-
"active": true,
8078
"link": "https://meebleforp.com",
8179
"gravatar": "263859aefe62ee6cc1aa993e8e2293e0",
8280
"gravatarAlt": "Zhang Yi Jiang",
@@ -86,7 +84,6 @@
8684
{
8785
"name": "E-Liang Tan",
8886
"description": "Makers gotta make. Software Engineer @ Ironclad, Ex-Software Engineer Intern @ Facebook",
89-
"active": true,
9087
"link": "https://www.eliangtan.com/",
9188
"gravatar": "3064783701c7bb1b4451c79318e1b536",
9289
"gravatarAlt": "E-Liang Tan",
@@ -106,5 +103,47 @@
106103
"twitter": "chrisgzf",
107104
"github": "chrisgzf",
108105
"linkedin": "chrisgzf"
106+
},
107+
{
108+
"name": "Wong Kok Rui",
109+
"description": "Likes geography trivia, ball sports, and musicals.",
110+
"active": true,
111+
"link": "https://kokruiwo.ng/",
112+
"gravatar": "7acde926ae46e7a9533715a387260c7a8677d648c2677a8f6ff97e9b6e02a49b",
113+
"gravatarAlt": "Wong Kok Rui",
114+
"github": "kokrui",
115+
"linkedin": "kokrui"
116+
},
117+
{
118+
"name": "Ravern Koh",
119+
"description": "I enjoy coding, reading, climbing and watching movies!",
120+
"active": true,
121+
"link": "https://github.com/ravern",
122+
"gravatar": "12caf9f1faf78359205cfa178379cb54c675193763b02beb2e18b9b3f5cccef1",
123+
"gravatarAlt": "Ravern Koh",
124+
"twitter": "ravernkoh",
125+
"github": "ravern",
126+
"linkedin": "ravern"
127+
},
128+
{
129+
"name": "Liew Zhao Wei",
130+
"description": "[object Object]",
131+
"active": true,
132+
"link": "https://github.com/zwliew",
133+
"gravatar": "lalalathisisbogus",
134+
"gravatarAlt": "Liew Zhao Wei",
135+
"github": "zwliew",
136+
"linkedin": "zwliew"
137+
},
138+
{
139+
"name": "Alissa",
140+
"description": "Coding on the weekdays, swimming on the weekends...",
141+
"active": true,
142+
"link": "https://www.github.com/alissayarmantho",
143+
"gravatar": "734d1659aa15ece4532e39008f4d9fc0745d852e60c9f966330d20db078d4711",
144+
"gravatarAlt": "Alissa",
145+
"twitter": "yarmantho",
146+
"github": "alissayarmantho",
147+
"linkedin": "alissayarmantho"
109148
}
110149
]

website/src/data/venues.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4587,6 +4587,22 @@
45874587
"y": 1.2949252184799644
45884588
}
45894589
},
4590+
"COM3-01-23": {
4591+
"roomName": "Seminar Room 14",
4592+
"floor": 1,
4593+
"location": {
4594+
"x": 103.7748425,
4595+
"y": 1.2950386
4596+
}
4597+
},
4598+
"COM3-01-25": {
4599+
"roomName": "Seminar Room 15",
4600+
"floor": 1,
4601+
"location": {
4602+
"x": 103.7749804,
4603+
"y": 1.2948523
4604+
}
4605+
},
45904606
"COM3-MPH": {
45914607
"roomName": "COM3-MPH",
45924608
"floor": 1,

website/src/utils/ical.test.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,8 +307,18 @@ describe(iCalForTimetable, () => {
307307
CS1010S,
308308
CS3216,
309309
};
310-
const actual = iCalForTimetable(1, mockTimetable, moduleData);
310+
const actual = iCalForTimetable(1, mockTimetable, moduleData, []);
311311
// 5 lesson types for cs1010s, 1 for cs3216, 1 exam for cs1010s
312312
expect(actual).toHaveLength(7);
313313
});
314+
315+
test('should produce the correct number of lesson after excluding hidden mod', () => {
316+
const moduleData = {
317+
CS1010S,
318+
CS3216,
319+
};
320+
const actual = iCalForTimetable(1, mockTimetable, moduleData, ['CS3216']);
321+
// 5 lesson types for cs1010s, 1 exam for cs1010s, ( 1 lesson for cs3216 will be exluded)
322+
expect(actual).toHaveLength(6);
323+
});
314324
});

website/src/utils/ical.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,7 @@ export default function iCalForTimetable(
174174
semester: Semester,
175175
timetable: SemTimetableConfigWithLessons,
176176
moduleData: { [moduleCode: string]: Module },
177+
hiddenModules: string[],
177178
academicYear: string = config.academicYear,
178179
): EventOption[] {
179180
const [year, month, day] = academicCalendar[academicYear][semester].start;
@@ -182,6 +183,8 @@ export default function iCalForTimetable(
182183
const events: EventOption[] = [];
183184

184185
_.each(timetable, (lessonConfig, moduleCode) => {
186+
if (hiddenModules.includes(moduleCode)) return;
187+
185188
_.each(lessonConfig, (lessons) => {
186189
lessons.forEach((lesson) => {
187190
events.push(iCalEventForLesson(lesson, moduleData[moduleCode], semester, firstDayOfSchool));

website/src/utils/timetables.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -484,7 +484,12 @@ function parseModuleConfig(serialized: string | string[] | null): ModuleLessonCo
484484
* - 1,2,3 => Weeks 1-3
485485
* - 1,2,3,5,6,7 => Weeks 1-3, 5-7
486486
*/
487-
export function formatNumericWeeks(weeks: NumericWeeks): string | null {
487+
export function formatNumericWeeks(unprocessedWeeks: NumericWeeks): string | null {
488+
// Ensure list of weeks are unique
489+
const weeks = unprocessedWeeks.filter(
490+
(value, index) => unprocessedWeeks.indexOf(value) === index,
491+
);
492+
488493
if (weeks.length === 13) return null;
489494
if (weeks.length === 1) return `Week ${weeks[0]}`;
490495

@@ -509,7 +514,7 @@ export function formatNumericWeeks(weeks: NumericWeeks): string | null {
509514
};
510515

511516
weeks.slice(1).forEach((next) => {
512-
if (next - end === 1) {
517+
if (next - end <= 1) {
513518
// Consecutive week number - keep going
514519
end = next;
515520
} else {

website/src/views/mpe/form/MpeFormContainer.tsx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,19 +25,18 @@ const MpeFormContainer: React.FC<Props> = ({ getSubmission, updateSubmission })
2525
Promise.all([fetchMpeModuleList(), getSubmission()])
2626
.then(([fetchedMpeModuleList, fetchedSubmission]) => {
2727
setMpeModuleList(fetchedMpeModuleList);
28+
const moduleLookup = new Map(
29+
fetchedMpeModuleList.map((module) => [module.moduleCode, module]),
30+
);
2831
setSubmission({
2932
...fetchedSubmission,
3033
// Replace data fetched from MPE server with latest data from MPE module list
31-
// TODO: Optimize. This does an linear time lookup for each preference
3234
preferences: fetchedSubmission.preferences.map((preference) => {
33-
const mpeModule = fetchedMpeModuleList.find(
34-
(m) => m.moduleCode === preference.moduleCode,
35-
);
35+
const mpeModule = moduleLookup.get(preference.moduleCode);
3636
if (!mpeModule) return preference;
3737
return {
3838
...preference,
3939
moduleTitle: mpeModule.title,
40-
moduleCode: mpeModule.moduleCode,
4140
moduleCredits: parseInt(mpeModule.moduleCredit, 10),
4241
};
4342
}),

website/src/views/planner/AddModule.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ export default class AddModule extends React.PureComponent<Props, State> {
119119

120120
<div className={styles.actions}>
121121
<button className={classnames('btn btn-primary')} type="submit">
122-
Add course
122+
Add Category
123123
</button>
124124
<button
125125
className={classnames(styles.cancel, 'btn btn-svg')}

website/src/views/planner/PlannerContainer/PlannerContainer.scss

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,20 @@
1212

1313
.header {
1414
display: flex;
15-
justify-content: space-between;
1615
align-items: center;
16+
width: 100%;
17+
gap: 1rem;
1718

18-
h1 {
19+
.headerLeft {
1920
display: flex;
21+
flex: 1;
2022
align-items: center;
2123
margin: 0;
22-
font-size: $font-size-xlg;
24+
25+
h1 {
26+
margin: 1rem;
27+
font-size: $font-size-xlg;
28+
}
2329

2430
button {
2531
margin-left: 1rem;
@@ -32,12 +38,21 @@
3238

3339
.headerRight {
3440
display: flex;
41+
justify-content: flex-end;
3542
align-items: center;
3643
}
3744

3845
.moduleStats {
46+
display: flex;
47+
flex-wrap: wrap;
3948
margin-right: 1rem;
49+
50+
p {
51+
white-space: nowrap;
52+
}
4053
}
54+
55+
@include scrollable;
4156
}
4257

4358
.addYearButton {
@@ -60,6 +75,9 @@
6075

6176
.moduleLists {
6277
display: flex;
78+
width: 100%;
79+
80+
@include scrollable;
6381
}
6482

6583
.modListHeaders {
@@ -71,6 +89,7 @@
7189
.trash {
7290
opacity: 0.6;
7391
width: $semester-width;
92+
min-width: $semester-width;
7493
border: 1px dashed;
7594
border-radius: 0.4rem;
7695
text-align: center;

0 commit comments

Comments
 (0)