コード例 #1
0
ファイル: contestA.js プロジェクト: Jyan94/gp
function getTodaysGames(req, res, next) {
  /*console.log(Games.Select.getAllGamesList(), 111111111);
  async.map(Games.Select.getAllGamesList(),
    function (game, callback) {
      callback(null, {
        awayScore: game.awayScore,
        currentInning: game.currentInning,
        gameDate: game.gameDate,
        homeScore: game.homeScore,
        id: game.id,
        longAwayName: game.longAwayName,
        longHomeName: game.longHomeName,
        shortAwayName: game.shortAwayName,
        shortHomeName: game.shortHomeName, //acronym for home team
        startTime: game.startTime,
        status: game.status
      });
    },
    function (err, games) {
      if (err) {
        next(err);
      }
      else {
        res.send(JSON.stringify(games));
      }
    });*/
  res.send(Games.Select.getAllGamesJSON());
}
コード例 #2
0
ファイル: contestA.js プロジェクト: Jyan94/gp
function checkGameEnd (pendingBet, callback) {
  var gameId = pendingBet.gameId;
  var game = Games.Select.getGameById(gameId);

  if (typeof(game) === 'undefined') {
    GamesDirect.select(gameId,
      function (err, game) {
        callback(!err && (game.status === 'closed'));
      });
  }
  else {
    callback(game.status === 'closed');
  }
}