(ai_id, client, callback)
| 46 | * @param {function} callback - A callback(err) function. |
| 47 | */ |
| 48 | var updateScore = function(ai_id, client, callback) { |
| 49 | if (ai_id == null) return callback(null); |
| 50 | |
| 51 | if (client == null) { |
| 52 | sqldb.getClient(function(err, client, done) { |
| 53 | if (ERR(err, callback)) return; |
| 54 | _updateScoreWithClient(ai_id, client, function(err) { |
| 55 | // Might not be enough error catching? |
| 56 | if (ERR(err, callback)) return; |
| 57 | done(null); |
| 58 | callback(null); |
| 59 | }); |
| 60 | }); |
| 61 | } else { |
| 62 | _updateScoreWithClient(ai_id, client, callback); |
| 63 | } |
| 64 | }; |
| 65 | |
| 66 | /** |
| 67 | * Internal function helper for updateScore, assumes sql-db client. |
no test coverage detected