Skip to content

Commit

Permalink
Merge pull request #231 from andromeda-hebat/dev/farrel
Browse files Browse the repository at this point in the history
sql fix
  • Loading branch information
FarrelAD authored Dec 21, 2024
2 parents 324ed62 + f57b2be commit 144ffb7
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.sql linguist-vendored
4 changes: 2 additions & 2 deletions app/controllers/HomeController.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public function viewDashboard(): void
switch ($_SESSION['role']) {
case 'Admin Prodi':
$statistic_request = StatistikRepository::getStatisticRequest('Prodi');
$all_req_verif = BerkasProdiRepository::getAllBerkasProdiReq();
$all_req_verif = BerkasProdiRepository::getAllSubmittedBerkasProdi();
$this->view("templates/header", $data);
$this->view("pages/admin_prodi/dashboard", [
'statistic_request' => $statistic_request,
Expand All @@ -51,7 +51,7 @@ public function viewDashboard(): void
break;
case 'Admin TA':
$statistic_request = StatistikRepository::getStatisticRequest('TA');
$all_req_verif = BerkasTARepository::getAllBerkasTAReq();
$all_req_verif = BerkasTARepository::getAllSubmittedBerkasTA();
$this->view("templates/header", $data);
$this->view("pages/admin_ta/dashboard", [
'statistic_request' => $statistic_request,
Expand Down
27 changes: 27 additions & 0 deletions app/repository/BerkasProdiRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,33 @@ public static function getAllBerkasProdiReq(): array
}
}

public static function getAllSubmittedBerkasProdi(): array
{
try {
return Database::getConnection()
->query(<<<SQL
SELECT
ROW_NUMBER() OVER (ORDER BY tanggal_request ASC) AS nomor,
v.id_verifikasi,
p.id_berkas_prodi AS id_berkas,
m.nim,
m.nama_lengkap,
p.tanggal_request,
v.status_verifikasi,
v.keterangan_verifikasi
FROM USERS.Mahasiswa m
INNER JOIN BERKAS.Prodi p ON m.nim = p.nim
INNER JOIN VER.VerifikasiBerkas v ON v.id_berkas = p.id_berkas_prodi
WHERE v.status_verifikasi = 'Diajukan'
ORDER BY p.tanggal_request DESC
SQL)
->fetchAll(\PDO::FETCH_CLASS, BerkasPengajuan::class);
} catch (\PDOException $e) {
error_log(ErrorLog::formattedErrorLog($e->getMessage()), 3, LOG_FILE_PATH);
throw new \PDOException($e->getMessage());
}
}

public static function getSingleBerkasProdiReq(int $id_verifikasi): bool|DetailBerkasProdiPengajuan
{
try {
Expand Down
27 changes: 27 additions & 0 deletions app/repository/BerkasTARepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,33 @@ public static function getAllBerkasTAReq(): array
}
}

public static function getAllSubmittedBerkasTA(): array
{
try {
return Database::getConnection()
->query(<<<SQL
SELECT
ROW_NUMBER() OVER (ORDER BY tanggal_request ASC) AS nomor,
vb.id_verifikasi,
ta.id_ta AS id_berkas,
m.nim,
m.nama_lengkap,
ta.tanggal_request,
vb.status_verifikasi,
vb.keterangan_verifikasi
FROM VER.VerifikasiBerkas vb
INNER JOIN BERKAS.TA ta ON vb.id_berkas = ta.id_ta
INNER JOIN USERS.Mahasiswa m ON ta.nim = m.nim
WHERE vb.status_verifikasi = 'Diajukan'
ORDER BY ta.tanggal_request DESC;
SQL)
->fetchAll(\PDO::FETCH_CLASS, BerkasPengajuan::class);
} catch (\PDOException $e) {
error_log(ErrorLog::formattedErrorLog($e->getMessage()), 3, LOG_FILE_PATH);
throw new \PDOException($e->getMessage());
}
}


public static function getSingleBerkasTAReq(int $id_verifikasi): bool|DetailBerkasTAPengajuan
{
Expand Down

0 comments on commit 144ffb7

Please sign in to comment.