Explorar el Código

fiks graph pelaporan

andifebri hace 3 años
padre
commit
ee6e692953
Se han modificado 2 ficheros con 5 adiciones y 5 borrados
  1. 2 2
      controller/graph.controller.js
  2. 3 3
      utils/cekData.js

+ 2 - 2
controller/graph.controller.js

@@ -293,8 +293,8 @@ exports.excel = handleError(async (req, res) => {
         (value.role_data == 'dikti' && user.role.id === 2020) ||
         (value.role_asal === 'lldikti' && value.role_data === 'lldikti') ||
         (value.role_data == 'lldikti' && user.role.id === 2021)
-      ? `Ditindaklanjuti ${value.role_data === 'dikti' ? 'DIKTI' : 'LLDIKTI'}`
-      : `Delegasi Ke ${value.role_data === 'dikti' ? 'DIKTI' : 'LLDIKTI'}`,
+        ? `Ditindaklanjuti ${value.role_data === 'dikti' ? 'DIKTI' : 'LLDIKTI'}`
+        : `Delegasi Ke ${value.role_data === 'dikti' ? 'DIKTI' : 'LLDIKTI'}`,
   }))
 
   const dataLaporan = laporan.map((value) => ({

+ 3 - 3
utils/cekData.js

@@ -193,14 +193,14 @@ exports.dataLaporanAggregate = async (user, where, aggregate) => {
   const w = { ...where }
   switch (user.role.id) {
     case 2020:
-      w.role_asal = 'dikti'
+      w['$or'] = [{ role_asal: 'dikti' }, { role_data: 'dikti' }]
       break
     case 2021:
-      w.role_asal = 'lldikti'
+      w['$or'] = [{ role_asal: 'lldikti' }, { role_data: 'lldikti' }]
       w['pt.pembina.id'] = user.lembaga.id
       break
   }
-  
+
   const laporan = await laporanModel.aggregate([
     { $match: w },
     { $group: aggregate },