yazid138 3 anos atrás
pai
commit
a3bcb298cd
1 arquivos alterados com 14 adições e 2 exclusões
  1. 14 2
      controller/graph.controller.js

+ 14 - 2
controller/graph.controller.js

@@ -394,7 +394,9 @@ exports.laporanSelesai = handleError(async (req, res) => {
 })
 
 exports.jumlahStatusLaporan = handleError(async (req, res) => {
-  let dataPembina = await laporanModel.find()
+  let dataPembina = await laporanModel.find({
+    aktif: true,
+  })
   const user = req.user
 
   dataPembina = [
@@ -424,6 +426,7 @@ exports.jumlahStatusLaporan = handleError(async (req, res) => {
         ).filter((e) => e.laporan != null),
         jumlah_jadwal_evaluasi: await laporanModel
           .find({
+            aktif: true,
             jadwal: {
               $ne: null,
               $exists: true,
@@ -433,8 +436,12 @@ exports.jumlahStatusLaporan = handleError(async (req, res) => {
           .count(),
         jumlah_pemeriksaan: await laporanModel
           .find({
+            aktif: true,
             evaluasi: {
-              $ne: [],
+              $ne: null,
+              $not: {
+                $size: 0,
+              },
               $exists: true,
             },
             'pt.pembina.id': e.id,
@@ -442,6 +449,7 @@ exports.jumlahStatusLaporan = handleError(async (req, res) => {
           .count(),
         jumlah_sanksi: await laporanModel
           .find({
+            aktif: true,
             sanksi: {
               $ne: null,
               $exists: true,
@@ -452,6 +460,7 @@ exports.jumlahStatusLaporan = handleError(async (req, res) => {
         jumlah_keberatan: (
           await sanksiModel
             .find({
+              aktif: true,
               'pengajuan.keberatan': {
                 $ne: null,
                 $exists: true,
@@ -467,6 +476,7 @@ exports.jumlahStatusLaporan = handleError(async (req, res) => {
         jumlah_banding: (
           await sanksiModel
             .find({
+              aktif: true,
               'pengajuan.banding': {
                 $ne: null,
                 $exists: true,
@@ -482,6 +492,7 @@ exports.jumlahStatusLaporan = handleError(async (req, res) => {
         jumlah_pemantauan_perbaikan: (
           await sanksiModel
             .find({
+              aktif: true,
               perbaikan: {
                 $ne: [],
                 $exists: true,
@@ -497,6 +508,7 @@ exports.jumlahStatusLaporan = handleError(async (req, res) => {
         jumlah_pencabutan_sanksi: (
           await sanksiModel
             .find({
+              aktif: true,
               'pengajuan.cabut_sanksi': {
                 $ne: null,
                 $exists: true,