yazid138 3 years ago
parent
commit
2626953fcb
1 changed files with 7 additions and 5 deletions
  1. 7 5
      utils/cekData.js

+ 7 - 5
utils/cekData.js

@@ -7,10 +7,9 @@ exports.cekSatuDataLaporan = async (
   res,
   user,
   laporan_id,
-  where = { delegasi: false }
+  where = { delegasi: false, aktif: true }
 ) => {
-  const w = { _id: laporan_id, aktif: true, ...where }
-  if (where.aktif === false) w.aktif = false
+  const w = { _id: laporan_id,...where }
   switch (user.role.id) {
     case 2020:
       if (!where.delegasi) w.role_data = 'dikti'
@@ -49,8 +48,11 @@ exports.cekSatuDataLaporan = async (
   return laporan
 }
 
-exports.cekBanyakDataLaporan = async (user, where = { delegasi: false }) => {
-  const w = { aktif: true, ...where }
+exports.cekBanyakDataLaporan = async (
+  user,
+  where = { delegasi: false, aktif: true }
+) => {
+  const w = { ...where }
   if (where.aktif === false) w.aktif = false
   switch (user.role.id) {
     case 2020: