瀏覽代碼

commit lagi andi

yazid138 2 年之前
父節點
當前提交
b720d635ac
共有 1 個文件被更改,包括 4 次插入3 次删除
  1. 4 3
      controller/graph.controller.js

+ 4 - 3
controller/graph.controller.js

@@ -396,18 +396,19 @@ exports.laporanSelesai = handleError(async (req, res) => {
 exports.jumlahStatusLaporan = handleError(async (req, res) => {
   let dataPembina = await laporanModel.find({
     aktif: true,
-  }).sort({'e.pt.pembina.nama': 1})
+  })
   const user = req.user
 
   dataPembina = [
     ...new Set(
-      dataPembina.map((e) => `${e.pt.pembina.id};${e.pt.pembina.nama}`)
+      dataPembina.map((e) => `${e.pt.pembina.nama};${e.pt.pembina.id}`)
     ),
   ]
+
   dataPembina = dataPembina.map((e) => ({
     id: e.split(';')[0],
     name: e.split(';')[1],
-  }))
+  })).sort((a, b) => a.name < b.name ? -1 : 1)
 
   let data = await Promise.all(
     dataPembina.map(async (e) => {