Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/modules/ncert/ncert.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ export class NcertController {
const classId = requireNcertParam(query, ['classId', 'class']);
const subjectId = requireNcertParam(query, ['subjectId', 'subject']);

const page = Math.max(1, parseInt(query.page as string) || 1);
const limit = Math.min(100, Math.max(1, parseInt(query.limit as string) || 20));
const page = Math.max(1, parseInt(query.page as string, 10) || 1);
const limit = Math.min(100, Math.max(1, parseInt(query.limit as string, 10) || 20));

const res = await NcertServices.getChapters(
subjectId,
Expand Down
6 changes: 3 additions & 3 deletions src/prisma/seed-content.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ async function seedChapterContent() {
return result;
}

const classFolders = (await readdir(learnerMdRoot)).sort();
const classFolders = (await readdir(learnerMdRoot)).sort((a, b) => a - b);

for (const classFolder of classFolders) {
const grade = parseGrade(classFolder);
Expand All @@ -203,7 +203,7 @@ async function seedChapterContent() {
continue;
}

const subjectFolders = (await readdir(classPath)).sort();
const subjectFolders = (await readdir(classPath)).sort((a, b) => a - b);

for (const subjectFolder of subjectFolders) {
const subjectPath = path.join(classPath, subjectFolder);
Expand Down Expand Up @@ -240,7 +240,7 @@ async function seedChapterContent() {
continue;
}

const chapterFiles = (await readdir(subjectPath)).sort();
const chapterFiles = (await readdir(subjectPath)).sort((a, b) => a - b);

for (const chapterFile of chapterFiles) {
const order = parseChapterOrder(chapterFile);
Expand Down
Loading