flyzto 7 mesiacov pred
rodič
commit
c763e8808d
2 zmenil súbory, kde vykonal 13 pridanie a 9 odobranie
  1. 7 7
      server/models/Games.js
  2. 6 2
      server/routes/triangle.js

+ 7 - 7
server/models/Games.js

@@ -290,18 +290,18 @@ const setSolutions = (solutions) => {
       solutionsHistory[sid].timestamp = timestamp;
 
     });
-    if (updateIds.add.length || updateIds.update.length) {
-      const solutionsList = Object.values(solutionsHistory).sort((a, b) => b.sol.win_average - a.sol.win_average);
-      Logs.outDev('solutions history update', JSON.stringify(solutionsList, null, 2), JSON.stringify(updateIds, null, 2));
-    }
+    // if (updateIds.add.length || updateIds.update.length) {
+    //   const solutionsList = Object.values(solutionsHistory).sort((a, b) => b.sol.win_average - a.sol.win_average);
+    //   Logs.outDev('solutions history update', JSON.stringify(solutionsList, null, 2), JSON.stringify(updateIds, null, 2));
+    // }
   }
 }
 
 /**
  * 获取中单方案
  */
-const getSolutions = () => {
-  const gamesRelations = getGamesRelation(true);
+const getSolutions = async () => {
+  const gamesRelations = await getGamesRelation();
   const relationsMap = new Map(gamesRelations.map(item => [item.id, item.rel]));
   const solutions = Object.values(GAMES.Solutions).sort((a, b) => b.sol.win_average - a.sol.win_average);
   return solutions.map(item => {
@@ -311,7 +311,7 @@ const getSolutions = () => {
       ...item,
       info: { id, ...relation }
     }
-  })
+  });
 }
 
 /**

+ 6 - 2
server/routes/triangle.js

@@ -72,8 +72,12 @@ router.get('/get_games_relation', (req, res) => {
 
 // 获取中单方案
 router.get('/get_solutions', authMiddleware, (req, res) => {
-  const solutions = Games.getSolutions();
-  res.sendSuccess(solutions);
+  Games.getSolutions().then(solutions => {
+    res.sendSuccess(solutions);
+  })
+  .catch(err => {
+    res.badRequest(err.message);
+  });
 });