Skip to content

Commit 8d92e7f

Browse files
authored
Merge pull request #109 from CodeChefVIT/staging
bugfix: removed hardcoded courselist array
2 parents bddf04c + c357755 commit 8d92e7f

File tree

2 files changed

+9
-240
lines changed

2 files changed

+9
-240
lines changed

Diff for: src/app/api/ai-upload/route.ts

+8-7
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import { NextResponse } from "next/server";
22
import { PDFDocument } from "pdf-lib";
33
import {
44
campuses,
5-
courses,
65
exams,
76
semesters,
87
slots,
@@ -71,7 +70,12 @@ export async function POST(req: Request) {
7170

7271
console.log(" tags:", tags);
7372

74-
const finalTags = await setTagsFromCurrentLists(tags);
73+
const { data } = await axios.get<ICourses[]>(
74+
`${process.env.SERVER_URL}/api/course-list`,
75+
);
76+
const courses = data.map((course: { name: string }) => course.name);
77+
78+
const finalTags = await setTagsFromCurrentLists(tags, courses);
7579
console.log(" tags:", finalTags);
7680

7781
const subject = finalTags.subject;
@@ -80,7 +84,6 @@ export async function POST(req: Request) {
8084
const year = finalTags.year;
8185
const campus = formData.get("campus") as string;
8286
const semester = finalTags.semester;
83-
8487
if (!courses.includes(subject)) {
8588
return NextResponse.json(
8689
{ message: "The course subject is invalid." },
@@ -251,11 +254,9 @@ async function CreatePDF(orderedFiles: File[]) {
251254
//sets course-name to corresponding course name from our api
252255
async function setTagsFromCurrentLists(
253256
tags: ExamDetail | undefined,
257+
courses: string[]
258+
254259
): Promise<ExamDetail> {
255-
const { data } = await axios.get<ICourses[]>(
256-
`${process.env.SERVER_URL}/api/course-list`,
257-
);
258-
const courses = data.map((course: { name: string }) => course.name);
259260
if (!courses[0] || !slots[0] || !exams[0] || !semesters[0] || !years[0]) {
260261
throw Error("Cannot fetch default value for courses/slot/exam/sem/year!");
261262
}

Diff for: src/components/select_options.ts

+1-233
Original file line numberDiff line numberDiff line change
@@ -1,235 +1,3 @@
1-
const courses = [
2-
"Digital Logic and Microprocessors [BITE202L]",
3-
"Structured and Object-Oriented Programming Lab [BCSE102P]",
4-
"Calculus [BMAT101L]",
5-
"Basic Electrical and Electronics Engineering [BEEE102L]",
6-
"Engineering Physics Lab [BPHY101P]",
7-
"Probability and Statistics [BMAT202L]",
8-
"Technical English Communication Lab [BENG101P]",
9-
"Technical Report Writing [BENG102P]",
10-
"Computer Programming: Python [BCSE101E]",
11-
"Computer Communication and Networking [BECE401L]",
12-
"Engineering Chemistry Lab [BCHY101P]",
13-
"Calculus Lab [BMAT101P]",
14-
"Basic Electrical and Electronics Engineering Lab [BEEE102P]",
15-
"Complex Variables and Linear Algebra [BMAT201L]",
16-
"Computer Programming: Java [BCSE103E]",
17-
"Java Programming [CSE1007]",
18-
"Digital Logic and Microprocessors Lab [BITE202P]",
19-
"Differential Equations and Transforms [BMAT102L]",
20-
"Engineering Chemistry [BCHY101L]",
21-
"Computer Architecture and Organization [BITE301L]",
22-
"Structured and Object-Oriented Programming [BCSE102L]",
23-
"Principles of Communication Systems [BITE203L]",
24-
"Engineering Physics [BPHY101L]",
25-
"Probability and Statistics Lab [BMAT202P]",
26-
"Discrete Mathematics and Graph Theory [BMAT205L]",
27-
"Database Systems [BITE302L]",
28-
"Database Systems [BCSE302L]",
29-
"Operating Systems [BITE303L]",
30-
"Operating Systems [BCSE303L]",
31-
"Data Structures and Algorithms Lab [BITE201P]",
32-
"Technical English Communication [BENG101L]",
33-
"Quantitative Skills Practice I [BSTS101P]",
34-
"Quantitative Skills Practice II [BSTS102P]",
35-
"Web Technologies Lab [BITE304P]",
36-
"Computer Networks [BITE305L]",
37-
"Operating Systems Lab [BITE303P]",
38-
"Web Technologies [BITE304L]",
39-
"Theory of Computation [BITE306L]",
40-
"Theory of Computation [BCSE304L]",
41-
"Qualitative Skills Practice I [BSTS201P]",
42-
"Distributed Computing [BITE402L]",
43-
"Network and Information Security [BITE401L]",
44-
"Database Systems Lab [BITE302P]",
45-
"Computer Networks Lab [BITE305P]",
46-
"Qualitative Skills Practice II [BSTS202P]",
47-
"Big Data Analytics [BITE411L]",
48-
"Embedded Systems and IoT [BITE403L]",
49-
"Data Structures and Algorithms [BITE201L]",
50-
"Data Structures and Algorithms [BCSE202L]",
51-
"Software Engineering Lab [BITE307P]",
52-
"Computer Graphics [BITE313L]",
53-
"Multimedia Systems [BITE314L]",
54-
"Software Engineering [BITE307L]",
55-
"Control Systems [BECE302L]",
56-
"Embedded Systems and IoT Lab [BITE403P]",
57-
"Artificial Intelligence [BITE308L]",
58-
"Artificial Intelligence [BCSE306L]",
59-
"Human Computer Interaction [BITE311L]",
60-
"Laboratory Project [BITE393J]",
61-
"Technical Answers to Real Problems Project [BITE391J]",
62-
"Artificial Intelligence Lab [BITE308P]",
63-
"Product Development Project [BITE394J]",
64-
"Simulation Project [BITE398J]",
65-
"Reading Course [BITE396J]",
66-
"Object Oriented Analysis and Design [BITE404E]",
67-
"Data Mining [BITE312E]",
68-
"Design Project [BITE392J]",
69-
"Parallel Computing [BITE406L]",
70-
"Special Project [BITE397J]",
71-
"Machine Learning [BITE410L]",
72-
"Machine Learning [BCSE209L]",
73-
"Cloud Computing [BITE412L]",
74-
"Mobile Application Development [BITE409L]",
75-
"Network Management [BITE408L]",
76-
"Cyber Security [BITE413L]",
77-
"Soft Computing [BITE405L]",
78-
"Essentials Of Data Analytics [BCSE352E]",
79-
"Blockchain Technology [BITE414L]",
80-
"Quantum Computing [BITE407L]",
81-
"Engineering Optimization [BITE415L]",
82-
"Engineering Optimization [BMEE215L]",
83-
"Biology [BBIT100L]",
84-
"Biobusiness [BBIT311L]",
85-
"AWS Solutions Architect [BCSE355L]",
86-
"Electronic Materials and Devices [BECE201L]",
87-
"Materials Science and Engineering [BMEE209L]",
88-
"Electromagnetic Theory [BEEE202L]",
89-
"Rural Development [BHUM202L]",
90-
"Circuit Theory [BECE203L]",
91-
"Introduction to Psychology [BHUM203L]",
92-
"Industrial Psychology [BHUM204L]",
93-
"Mass Communication [BHUM201L]",
94-
"Development Economics [BHUM205L]",
95-
"International Economics [BHUM206L]",
96-
"Engineering Economics [BHUM207L]",
97-
"Economics of Strategy [BHUM208L]",
98-
"Game Theory [BHUM209L]",
99-
"Behavioral Economics [BHUM211L]",
100-
"Behavioral Economics [HUM1046]",
101-
"Econometrics [BHUM210E]",
102-
"Fluid Mechanics and Machines [BMEE204L]",
103-
"Cloud Computing using Salesforce [BMEE355L]",
104-
"Metal Casting and Welding [BMEE302L]",
105-
"Metal Forming and Machining [BMEE304L]",
106-
"Contemporary India [BHUM217L]",
107-
"Mathematics for Economic Analysis [BHUM212L]",
108-
"Corporate Social Responsibility [BHUM213L]",
109-
"Political Science [BHUM214L]",
110-
"Economics of Money, Banking and Financial Markets [BHUM221L]",
111-
"Kinematics and Dynamics of Machines [BMEE207L]",
112-
"Financial Management [BHUM218L]",
113-
"Security Analysis and Portfolio Management [BHUM222L]",
114-
"Indian Culture and Heritage [BHUM216L]",
115-
"Mechatronics and Measurement Systems [BMEE210L]",
116-
"International Relations [BHUM215L]",
117-
"Financial Markets and Institutions [BHUM220L]",
118-
"Principles of Accounting [BHUM219L]",
119-
"Options , Futures and other Derivatives [BHUM223L]",
120-
"Corporate Finance [BHUM226L]",
121-
"Engineering Thermodynamics [BMEE203L]",
122-
"Fixed Income Securities [BHUM224L]",
123-
"Personal Finance [BHUM225L]",
124-
"Cost and Management Accounting [BHUM228L]",
125-
"Health Humanities in Biotechnological Era [BHUM230L]",
126-
"Mind, Embodiment and Technology [BHUM229L]",
127-
"Financial Statement Analysis [BHUM227L]",
128-
"Environmental Psychology [BHUM233L]",
129-
"Introduction to Sustainable Aging [BHUM232L]",
130-
"Reproductive Choices for a Sustainable Society [BHUM231L]",
131-
"Taxation [BHUM236L]",
132-
"Psychology of Wellness [BHUM235E]",
133-
"Indian Psychology [BHUM234L]",
134-
"Design of Machine Elements [BMEE301L]",
135-
"Thermal Engineering Systems [BMEE303L]",
136-
"Mathematics [BMAT100L]",
137-
"Engineering Design Visualisation Lab [BMEE102P]",
138-
"Engineering Mechanics [BMEE201L]",
139-
"Entrepreneurship [BMGT108L]",
140-
"Mechanics of Solids [BMEE202L]",
141-
"Introduction to Intellectual Property [BMGT109L]",
142-
"Optics [BPHY201L]",
143-
"Computational Physics [BPHY301E]",
144-
"Physics Lab [BPHY302P]",
145-
"Classical Mechanics [BPHY202L]",
146-
"Electromagnetic Theory [BPHY402L]",
147-
"Quantum Mechanics [BPHY203L]",
148-
"Solid State Physics [BPHY401L]",
149-
"Atomic and Nuclear Physics [BPHY403L]",
150-
"Statistical Mechanics [BPHY404L]",
151-
"Advanced Competitive Coding - I [BSTS301P]",
152-
"Advanced Competitive Coding - II [BSTS302P]",
153-
"E-Business [CFOC133M]",
154-
"Emotional Intelligence [CFOC105M]",
155-
"Forests and their Management [CFOC191M]",
156-
"Ethical Hacking [CFOC188M]",
157-
"Rocket Propulsion [CFOC235M]",
158-
"Natural Hazards [CFOC203M]",
159-
"Training of Trainers [CFOC119M]",
160-
"Compiler Design [BCSE307L]",
161-
"Business Statistics [CFOC498M]",
162-
"Entrepreneurship Essentials [CFOC384M]",
163-
"Public Speaking [CFOC570M]",
164-
"Speaking Effectively [CFOC395M]",
165-
"Wildlife Ecology [CFOC575M]",
166-
"International Business [CFOC543M]",
167-
"Entrepreneurship [CFOC508M]",
168-
"Ethics and Values [BHUM101N]",
169-
"Economics of Banking and Finance Markets [CFOC587M]",
170-
"Indian Constitution [BSSC102N]",
171-
"Leadership and Team Effectiveness [CFOC599M]",
172-
"Effective English Communication [BENG101N]",
173-
"Environmental Sciences [BCHY102N]",
174-
"Essence of Traditional Knowledge [BSSC101N]",
175-
"Introduction to Engineering [BITE101N]",
176-
"Chinese I [BCHI101L]",
177-
"Arabic [BARB101L]",
178-
"Modern Greek [BGRE101L]",
179-
"Spanish I [BESP101L]",
180-
"French I [BFRE101L]",
181-
"German I [BGER101L]",
182-
"Basic Korean - Level 1 [BKOR101L]",
183-
"Italian [BITL101L]",
184-
"Basic Korean - Level 2 [BKOR102L]",
185-
"Global Warming [BCLE214L]",
186-
"Waste Management [BCLE215L]",
187-
"Japanese I [BJAP101L]",
188-
"Natural Disaster Mitigation and Management [BCLE212L]",
189-
"Indian Classical Music [BHUM102E]",
190-
"Water Resource Management [BCLE216L]",
191-
"Micro Economics [BHUM103L]",
192-
"Macro Economics [BHUM104L]",
193-
"Sustainability and Society [BHUM107L]",
194-
"Principles of Sociology [BHUM106L]",
195-
"Public Policy and Administration [BHUM105L]",
196-
"Urban Community Development [BHUM108L]",
197-
"Social Work and Sustainability [BHUM109L]",
198-
"Principles of Management [BMGT101L]",
199-
"Organizational Behavior [BMGT103L]",
200-
"Cognitive Psychology [BHUM110]",
201-
"Microprocessors and Microcontrollers Lab [BEEE309P]",
202-
"Microprocessors and Microcontrollers [BECE204L]",
203-
"Big Data Analytic Applications to Electrical Systems [BECS403L]",
204-
"Big Data Analytic Applications to Electrical Systems Lab [BECS403P]",
205-
"Cyber Security [BCSE410L]",
206-
"Introduction to The Art of Hunting Cryptically [CRY2024]",
207-
"Analog Circuits [BECE206L]",
208-
"Analog Communication Systems [BECE304L]",
209-
"Antenna and Microwave Engineering [BECE305L]",
210-
"AWS for Cloud Computing [BECE355L]",
211-
"Digital System Design [BECE102L]",
212-
"Sensors technology [BECE409E]",
213-
"Robotics and Automation [BECE312L]",
214-
"Random Processes [BECE207L]",
215-
"VLSI System Design [BECE303L]",
216-
"Digital Communication System [BECE306L]",
217-
"Computer Networks [BCSE308L]",
218-
"Foundations of Data Analytics [BCSE351E]",
219-
"Embedded Systems Design [BECE403E]",
220-
"Electronic Devices and Circuits [BECE205L]",
221-
"Linear Algebra [UMAT201L]",
222-
"Digital Watermarking and Steganography [BCSE323L]",
223-
"Electronic Circuits [BEVD204L]",
224-
"Digital Signal Processing [BECE301L]",
225-
"Signals and Systems [BECE202L]",
226-
"Signals and Systems [BEEE204L]",
227-
"Engineering Electromagnetics [BECE205L]",
228-
"Digital Electronics [BEEE206L]",
229-
"Artficial Intelligence [CBS3004]",
230-
"Information Security [CBS3002]",
231-
"Design and Analysis of Algorithms [MCSE502L]",
232-
];
2331

2342
const slots: string[] = [
2353
"A1",
@@ -272,4 +40,4 @@ const campuses: string[] = [
27240
];
27341
const exams: string [] = ["CAT-1", "CAT-2", "FAT","Model CAT-1" , "Model CAT-2" , "Model FAT"]
27442
const semesters: string[] = ["Fall Semester", "Winter Semester", "Summer Semester", "Weekend Semester"];
275-
export { slots, courses, years, campuses, semesters, exams };
43+
export { slots, years, campuses, semesters, exams };

0 commit comments

Comments
 (0)