Skip to content

Commit 6b044db

Browse files
committed
fresher courses
1 parent cfda935 commit 6b044db

File tree

27 files changed

+937
-107
lines changed

27 files changed

+937
-107
lines changed

src/components/cards/FacultySelector.tsx

Lines changed: 66 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { ZButton } from '../ui/Buttons';
77
import { data } from '@/data/faculty';
88
import { fullCourseData } from '@/lib/type';
99
import AlertModal from '../ui/AlertModal';
10+
import { course_type_map } from '@/lib/course_codes_map';
1011

1112
const schools = [
1213
'SCOPE',
@@ -18,17 +19,18 @@ const schools = [
1819
'SENSE',
1920
'SCE',
2021
'SHINE',
21-
'MTech',
22+
'MTech (SCOPE)',
23+
// 'MTech (SCORE)',
2224
'SCOPE (Fresher)',
2325
'SCORE (Fresher)',
2426
'SELECT (Fresher)',
2527
'SMEC (Fresher)',
26-
'SBST (Fresher)',
27-
'SCHEME (Fresher)',
28+
// 'SBST (Fresher)',
29+
// 'SCHEME (Fresher)',
2830
'SENSE (Fresher)',
29-
'SCE (Fresher)',
30-
'SHINE (Fresher)',
31-
'MTech (Fresher)',
31+
// 'SCE (Fresher)',
32+
// 'SHINE (Fresher)',
33+
// 'MTech (Fresher)',
3234
];
3335

3436
type SelectFieldProps = {
@@ -213,25 +215,33 @@ function generateCourseSlotsBoth({
213215
selectedSubject,
214216
selectedSlot,
215217
selectedFaculties,
218+
courseCodeType,
216219
}: {
217220
data: FacultyData;
218221
selectedSchool: string;
219222
selectedDomain: string;
220223
selectedSubject: string;
221224
selectedSlot: string;
222225
selectedFaculties: string[];
226+
courseCodeType: 'L' | 'P' | 'E' | undefined;
223227
}) {
224228
const [courseCode] = selectedSubject.split(' - ');
225229
const baseCode = courseCode.slice(0, -1);
226230

227-
const labEntryKey = Object.keys(data[selectedSchool][selectedDomain]).find(key => {
228-
const code = key.split(' - ')[0];
229-
return code.slice(0, -1) === baseCode && (code.endsWith('P') || code.endsWith('E'));
230-
});
231+
let labData: SubjectEntry[] = [];
231232

232-
const labData: SubjectEntry[] = labEntryKey
233-
? data[selectedSchool][selectedDomain][labEntryKey]
234-
: [];
233+
if (courseCodeType === 'E') {
234+
labData = data[selectedSchool][selectedDomain][selectedSubject];
235+
} else {
236+
const labEntryKey = Object.keys(data[selectedSchool][selectedDomain]).find(key => {
237+
const code = key.split(' - ')[0];
238+
const type = getCourseType(code);
239+
return code.slice(0, -1) === baseCode && (type === 'P' || type === 'E');
240+
});
241+
if (labEntryKey) {
242+
labData = data[selectedSchool][selectedDomain][labEntryKey];
243+
}
244+
}
235245

236246
const isMorningTheory = selectedSlot.includes('1');
237247
const isEveningTheory = selectedSlot.includes('2');
@@ -259,7 +269,7 @@ function generateCourseSlotsBoth({
259269

260270
return {
261271
facultyName,
262-
...(labSlots.length > 0 && { facultyLabSlot: labSlots.join(', ') }),
272+
facultyLabSlot: labSlots.length > 0 ? labSlots.join(', ') : courseCode,
263273
};
264274
});
265275

@@ -280,6 +290,18 @@ const prettifyDomain = (domain: string) => {
280290
.replace(/([A-Z])([A-Z][a-z])/g, '$1 $2')
281291
.trim();
282292
};
293+
294+
const getCourseType = (courseCode: string): 'L' | 'P' | 'E' | undefined => {
295+
if (course_type_map[courseCode]) {
296+
return course_type_map[courseCode] as 'L' | 'P' | 'E';
297+
}
298+
const lastChar = courseCode.slice(-1).toUpperCase();
299+
if (['L', 'P', 'E'].includes(lastChar)) {
300+
return lastChar as 'L' | 'P' | 'E';
301+
}
302+
return undefined;
303+
};
304+
283305
type ShiftKey = 'morning' | 'evening';
284306
export default function FacultySelector({
285307
onConfirm,
@@ -328,18 +350,16 @@ export default function FacultySelector({
328350
setPopup({ showPopup: true, message: 'Please select a subject.' });
329351
return;
330352
}
331-
if (
332-
!selectedLabShift &&
333-
selectedSubject.split(' - ')[0].endsWith('P') &&
334-
!selectedSubject.split(' - ')[0].startsWith('BSTS')
335-
) {
353+
const courseCode = selectedSubject.split(' - ')[0];
354+
const courseCodeType = getCourseType(courseCode);
355+
356+
if (!selectedLabShift && courseCodeType === 'P' && !courseCode.startsWith('BSTS')) {
336357
setPopup({ showPopup: true, message: 'Please select a lab slot.' });
337358
return;
338359
}
339360
if (
340361
!selectedSlot &&
341-
(!selectedSubject.split(' - ')[0].endsWith('P') ||
342-
selectedSubject.split(' - ')[0].startsWith('BSTS'))
362+
(courseCodeType === 'L' || courseCodeType === 'E' || courseCode.startsWith('BSTS'))
343363
) {
344364
setPopup({ showPopup: true, message: 'Please select a theory slot.' });
345365
return;
@@ -355,39 +375,36 @@ export default function FacultySelector({
355375
setPopup({ showPopup: true, message: 'Successfully added course' });
356376
}
357377

358-
const courseCode = selectedSubject.split(' - ')[0];
359-
const courseCodeType = courseCode.at(-1);
360378
const id = selectedSubject;
361379

362380
const labSubject = Object.keys(data[selectedSchool][selectedDomain]).filter(subject => {
363381
const subjectCode = subject.split(' - ')[0];
382+
const subjectType = getCourseType(subjectCode);
364383
return (
365384
subjectCode.slice(0, -1) === courseCode.slice(0, -1) &&
366-
(subjectCode.at(-1) === 'P' || subjectCode.at(-1) === 'E') &&
385+
(subjectType === 'P' || subjectType === 'E') &&
367386
subjectCode !== courseCode &&
368387
!courseCode.startsWith('BSTS')
369388
);
370389
});
371390

372391
const courseType: 'both' | 'th' | 'lab' =
373-
labSubject.length == 1 || courseCodeType === 'E'
392+
labSubject.length === 1 && courseCodeType !== 'E'
374393
? 'both'
375394
: courseCodeType === 'P' && !courseCode.startsWith('BSTS')
376395
? 'lab'
377-
: courseCodeType === 'L' || courseCode.startsWith('BSTS')
378-
? 'th'
379-
: 'th';
396+
: 'th';
380397

381398
const courseName = selectedSubject.split(' - ')[1];
382399

383400
let courseCodeLab;
384401
let courseNameLab;
385402
let courseSlots;
386-
if (courseCodeType == 'E') {
387-
courseCodeLab = courseCode;
388-
courseNameLab = courseName;
403+
if (courseCodeType === 'E') {
404+
courseCodeLab = '';
405+
courseNameLab = '';
389406
} else {
390-
courseCodeLab = courseCodeLab = labSubject.length == 1 ? labSubject[0].split(' - ')[0] : '';
407+
courseCodeLab = labSubject.length == 1 ? labSubject[0].split(' - ')[0] : '';
391408
courseNameLab = labSubject.length == 1 ? labSubject[0].split(' - ')[1] : '';
392409
}
393410
if (selectedLabShift) {
@@ -397,14 +414,15 @@ export default function FacultySelector({
397414
labShift: selectedLabShift,
398415
});
399416
} else {
400-
if (courseType == 'both') {
417+
if (courseType == 'both' || courseCodeType === 'E') {
401418
courseSlots = generateCourseSlotsBoth({
402419
data,
403420
selectedSchool,
404421
selectedDomain,
405422
selectedSubject,
406423
selectedSlot,
407424
selectedFaculties: priorityList,
425+
courseCodeType,
408426
});
409427
} else if (courseType == 'th') {
410428
courseSlots = generateCourseSlotsSingle({
@@ -424,13 +442,14 @@ export default function FacultySelector({
424442
}
425443
const courseData: fullCourseData = {
426444
id,
427-
courseType,
445+
courseType: courseCodeType === 'E' ? 'both' : courseType,
428446
courseCode,
429447
courseName,
430-
...((labSubject.length == 1 || courseCodeType === 'E') && {
431-
courseCodeLab,
432-
courseNameLab,
433-
}),
448+
...(labSubject.length == 1 &&
449+
courseCodeType !== 'E' && {
450+
courseCodeLab,
451+
courseNameLab,
452+
}),
434453
courseSlots: courseSlots!,
435454
};
436455

@@ -493,9 +512,10 @@ export default function FacultySelector({
493512

494513
const filteredSubjects = allSubjects.filter(subject => {
495514
const code = subject.split(' - ')[0];
496-
const base = code.slice(0, -1);
497-
if (code.endsWith('P')) {
498-
return !allSubjects.some(s => s.startsWith(base + 'L'));
515+
const type = getCourseType(code);
516+
if (type === 'P') {
517+
const theoryCode = code.slice(0, -1) + 'L';
518+
return !allSubjects.some(s => s.startsWith(theoryCode));
499519
}
500520
return true;
501521
});
@@ -505,8 +525,9 @@ export default function FacultySelector({
505525
if (selectedSubject) {
506526
const subjectData = domainData[selectedSubject];
507527
const courseCode = selectedSubject.split(' - ')[0];
528+
const courseType = getCourseType(courseCode);
508529

509-
if (courseCode.endsWith('P') && !courseCode.startsWith('BSTS')) {
530+
if (courseType === 'P' && !courseCode.startsWith('BSTS')) {
510531
const allLabSlots = [...new Set(subjectData.map(entry => entry.slot))];
511532

512533
const morningLabSlots = allLabSlots.filter(slot => {
@@ -684,7 +705,7 @@ export default function FacultySelector({
684705
options={subjects}
685706
onChange={handleSubjectChange}
686707
/>
687-
{selectedSubject.split(' - ')[0].endsWith('P') &&
708+
{getCourseType(selectedSubject.split(' - ')[0]) === 'P' &&
688709
!selectedSubject.split(' - ')[0].startsWith('BSTS') ? (
689710
<SelectField
690711
label="Slot"
@@ -730,9 +751,10 @@ export default function FacultySelector({
730751

731752
const labSubjectKey = Object.keys(domainData).find(subject => {
732753
const subjectCode = subject.split(' - ')[0];
754+
const subjectType = getCourseType(subjectCode);
733755
return (
734756
subjectCode.slice(0, -1) === baseCode &&
735-
(subjectCode.endsWith('P') || subjectCode.endsWith('E'))
757+
(subjectType === 'P' || subjectType === 'E')
736758
);
737759
});
738760

src/data/MTech/index.ts

Lines changed: 0 additions & 13 deletions
This file was deleted.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
export const PC = {
1+
export const PC_MIC = {
22
'CSI1007 - Software Engineering Principles': [
33
{ slot: 'B1', venue: 'PRP134', faculty: 'RAMANATHAN L' },
44
{ slot: 'L39+L40', venue: 'PRP353', faculty: 'RAMANATHAN L' },
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
export const PE = {
1+
export const PE_MIC = {
22
'CSI3005 - Advanced Data Visualization Techniques': [
33
{ slot: 'A1+TA1', venue: 'SJT502', faculty: 'ABDUL GAFFAR H' },
44
{ slot: 'L45+L46', venue: 'SJT417', faculty: 'ABDUL GAFFAR H' },
File renamed without changes.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
export const UC = {
1+
export const UC_MIC = {
22
'CHY1701 - Engineering Chemistry': [
33
{ slot: 'L3+L4', venue: 'PRP408A', faculty: 'TALAMARLLA DEEPTHI' },
44
{ slot: 'C2+TC2', venue: 'SJT803', faculty: 'SANTHAKUMAR K' },
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
export const UE = {
1+
export const UE_MIC = {
22
'CBS1904 - Capstone Project': [{ slot: 'NIL', venue: 'NIL', faculty: 'PLACEMENT AND TRAINING' }],
33
'CSE1030 - Introduction to Internet of Things': [
44
{ slot: 'D1+TD1', venue: 'PRP732', faculty: 'MEHFOOZA' },

src/data/MTech_SCOPE/index.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import { SPE } from './SpecializationElective';
2+
3+
import { PC_MIC } from './PC_MIC';
4+
import { PE_MIC } from './PE_MIC';
5+
import { UC_MIC } from './UC_MIC';
6+
import { UE_MIC } from './UE_MIC';
7+
8+
export const MTech_SCOPE = {
9+
'ProgrammeCore - MIC': PC_MIC,
10+
'ProgrammeElective - MIC': PE_MIC,
11+
'UniversityCore - MIC': UC_MIC,
12+
'UniversityElective - MIC': UE_MIC,
13+
SpecializationElective: SPE,
14+
};

src/data/MTech_SCORE/index.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// import { SPE } from './SpecializationElective';
2+
3+
// import { PC_MIC } from './PC_MIC';
4+
// import { PE_MIC } from './PE_MIC';
5+
// import { UC_MIC } from './UC_MIC';
6+
// import { UE_MIC } from './UE_MIC';
7+
8+
export const MIS_LIST = {
9+
// "ProgrammeCore - MIC": PC_MIC,
10+
// "ProgrammeElective - MIC": PE_MIC,
11+
// "UniversityCore - MIC": UC_MIC,
12+
// "UniversityElective - MIC": UE_MIC,
13+
// SpecializationElective: SPE,
14+
};

src/data/SCOPE_F/UCC.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -153,17 +153,17 @@ export const UCC = {
153153
{ slot: 'B2+TB2', venue: 'TT531', faculty: 'RAJU R.L.N' },
154154
{ slot: 'L13+L14', venue: 'TT432', faculty: 'RAJU R.L.N' },
155155
],
156-
'BAHUM101 - India Studies': [
157-
{ slot: 'NIL', venue: 'NIL', faculty: 'RUPAK KUMAR' },
158-
{ slot: 'NIL', venue: 'NIL', faculty: 'RAMNATH REGHUNADHAN' },
159-
{ slot: 'NIL', venue: 'NIL', faculty: 'RIZWAN AHMAD' },
160-
{ slot: 'NIL', venue: 'NIL', faculty: 'SALMAN HAIDER' },
161-
{ slot: 'NIL', venue: 'NIL', faculty: 'SUDHEER C V' },
162-
{ slot: 'NIL', venue: 'NIL', faculty: 'SHAHID HAMID RAINA' },
163-
{ slot: 'NIL', venue: 'NIL', faculty: 'AQUIB PARVEZ' },
164-
{ slot: 'NIL', venue: 'NIL', faculty: 'ADIL AHMAD SHAH' },
165-
{ slot: 'NIL', venue: 'NIL', faculty: 'MULUGU S NEELOTPAL' },
166-
],
156+
// 'BAHUM101 - India Studies': [
157+
// { slot: 'NIL', venue: 'NIL', faculty: 'RUPAK KUMAR' },
158+
// { slot: 'NIL', venue: 'NIL', faculty: 'RAMNATH REGHUNADHAN' },
159+
// { slot: 'NIL', venue: 'NIL', faculty: 'RIZWAN AHMAD' },
160+
// { slot: 'NIL', venue: 'NIL', faculty: 'SALMAN HAIDER' },
161+
// { slot: 'NIL', venue: 'NIL', faculty: 'SUDHEER C V' },
162+
// { slot: 'NIL', venue: 'NIL', faculty: 'SHAHID HAMID RAINA' },
163+
// { slot: 'NIL', venue: 'NIL', faculty: 'AQUIB PARVEZ' },
164+
// { slot: 'NIL', venue: 'NIL', faculty: 'ADIL AHMAD SHAH' },
165+
// { slot: 'NIL', venue: 'NIL', faculty: 'MULUGU S NEELOTPAL' },
166+
// ],
167167
'BAMAT101 - Multivariable Calculus and Differential Equations': [
168168
{ slot: 'D2+TD2', venue: 'PRP634', faculty: 'UMA K' },
169169
{ slot: 'L5+L6', venue: 'PRP119', faculty: 'UMA K' },

0 commit comments

Comments
 (0)