From f0061568f29afd24f419a22561303e780287d65c Mon Sep 17 00:00:00 2001
From: Rinaldy Adin <16521390@mahasiswa.itb.ac.id>
Date: Tue, 28 May 2024 15:49:48 +0700
Subject: [PATCH] fix regist sidsem pagination

---
 src/registrasi-sidsem/registrasi-sidsem.service.ts | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/src/registrasi-sidsem/registrasi-sidsem.service.ts b/src/registrasi-sidsem/registrasi-sidsem.service.ts
index c803fb8..20053bc 100644
--- a/src/registrasi-sidsem/registrasi-sidsem.service.ts
+++ b/src/registrasi-sidsem/registrasi-sidsem.service.ts
@@ -221,8 +221,7 @@ export class RegistrasiSidsemService {
       .leftJoin("pt.dosenBimbingan", "dosenBimbingan")
       .leftJoin("dosenBimbingan.dosen", "dosen")
       .leftJoin("pt.mahasiswa", "mahasiswa")
-      .where("mahasiswa.aktif = true")
-      .orderBy("ps.waktuPengiriman", "DESC");
+      .where("mahasiswa.aktif = true");
 
     if (idPembimbing) {
       baseQuery
@@ -268,7 +267,7 @@ export class RegistrasiSidsemService {
 
     if (query.limit) {
       baseQuery.take(query.limit);
-      baseQuery.skip((query.page - 1) * query.limit);
+      baseQuery.skip(((query.page ?? 1) - 1) * query.limit);
     }
 
     const [queryData, total] = await baseQuery.getManyAndCount();
-- 
GitLab