Skip to content
This repository was archived by the owner on Nov 30, 2025. It is now read-only.

Commit 20a2506

Browse files
committed
Removed commented out functions and functions that no longer get called
1 parent e3368d6 commit 20a2506

File tree

2 files changed

+0
-60
lines changed

2 files changed

+0
-60
lines changed

server/api/controllers/exam-bank-controller.ts

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -138,9 +138,6 @@ export class ExamBankController {
138138
* Gets an array of every exam currently in the exam list folder
139139
*/
140140
private static async generateExamsList(): Promise<Exam[]> {
141-
// currently this doesn't work
142-
// await this.validateTerms();
143-
144141
const examFiles: Dirent[] = readdirSync("public/exams", {
145142
withFileTypes: true,
146143
});
@@ -215,26 +212,4 @@ export class ExamBankController {
215212
}
216213
}
217214
}
218-
219-
private static async validateTerms() {
220-
const examFiles: Dirent[] = readdirSync("public/exams", {
221-
withFileTypes: true,
222-
});
223-
224-
let valid = true;
225-
for (const exam of examFiles) {
226-
const parts = exam.name.split("-");
227-
const term = parts[2].padStart(4, "0");
228-
229-
const isValidTerm = TermNameController.validateTerm(term);
230-
if (!isValidTerm) {
231-
valid = false;
232-
break;
233-
}
234-
}
235-
// doesn't work currently
236-
// if (!valid) {
237-
// await TermNameController.overwriteTermsFile();
238-
// }
239-
}
240215
}

server/api/controllers/term-name-controller.ts

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -8,27 +8,6 @@ export class TermNameController {
88
static logger = new Logger("Term Name Controller");
99
static termCache = new Map<string, string>(); // cache of termCodes
1010

11-
// static async getTermNames(): Promise<Term[]> {
12-
// const url = `${tokens.WATERLOO_OPEN_API_BASE_URL}/Terms`;
13-
// const response = await fetch(new URL(url), {
14-
// method: "GET",
15-
// headers: {
16-
// "X-API-KEY": tokens.WATERLOO_OPEN_API_KEY as string,
17-
// "Content-Type": "application/json",
18-
// },
19-
// });
20-
21-
// const terms: Term[] = await response.json();
22-
// return terms;
23-
// }
24-
25-
static validateTerm(term: string): boolean {
26-
const terms = this.getTermsFile();
27-
const termCodes = terms.map((item) => item.termCode);
28-
29-
return termCodes.includes(term);
30-
}
31-
3211
static getTermsFile(): Term[] {
3312
try {
3413
const terms = fs.readFileSync("server/data/_hidden/term-list.json");
@@ -68,18 +47,4 @@ export class TermNameController {
6847

6948
return termName;
7049
}
71-
72-
// static async overwriteTermsFile() {
73-
// try {
74-
// const terms = await this.getTermNames();
75-
// const url = "_hidden/term-list";
76-
// const fullPath = `server/data/${url}.json`;
77-
78-
// fs.writeFileSync(fullPath, JSON.stringify(terms));
79-
// this.logger.info("Terms file rewritten");
80-
// } catch (err) {
81-
// this.logger.error("Could not rewrite terms file.");
82-
// this.logger.error(err);
83-
// }
84-
// }
8550
}

0 commit comments

Comments
 (0)