Skip to content

Commit

Permalink
fix cheese issue, fix mmstats
Browse files Browse the repository at this point in the history
  • Loading branch information
albertcui committed Oct 31, 2015
1 parent 463052c commit 53e4567
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 11 deletions.
2 changes: 1 addition & 1 deletion retriever.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ function genStats() {
}

function getMMStats(idx, cb) {
steamObj[idx].Dota2.matchmakingStatsRequest();
steamObj[idx].Dota2.requestMatchmakingStats();
steamObj[idx].Dota2.once('matchmakingStatsData', function(waitTimes, searchingPlayers, disabledGroups, raw) {
cb(null, raw.searching_players_by_group_source2);
});
Expand Down
11 changes: 5 additions & 6 deletions routes/donate.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,16 +91,15 @@ module.exports = function(db, redis) {
redis.expire("cheese_goal", 86400 - moment().unix() % 86400);
}
if (req.user && payment.transactions[0]) {
var cheeseTotal = (req.user.cheese || 0) + parseInt(payment.transactions[0].amount.total, 10);
db('players').update({
cheese: cheeseTotal
}).where({
db('players')
.increment("cheese", parseInt(payment.transactions[0].amount.total, 10) || 0)
.where({
account_id: req.user.account_id
}).asCallback(function(err) {
if (err) {
return next(err);
}
req.session.cheeseTotal = cheeseTotal;

res.redirect("/thanks");
});
}
Expand All @@ -113,7 +112,7 @@ module.exports = function(db, redis) {
});
donate.route('/thanks').get(function(req, res) {
var cheeseCount = req.session.cheeseAmount;
var cheeseTotal = req.session.cheeseTotal;
var cheeseTotal = req.user.cheese;
clearPaymentSessions(req);
res.render("thanks", {
cheese: cheeseCount,
Expand Down
4 changes: 1 addition & 3 deletions sql/create.sql
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
--postgres user by default connects to postgres db
ALTER USER postgres WITH PASSWORD 'postgres';
--default schema is public
drop schema public cascade;
create schema public;
Expand Down Expand Up @@ -57,7 +55,7 @@ CREATE TABLE players (
personaname varchar(255),
last_login timestamp with time zone,
full_history_time timestamp with time zone,
cheese integer,
cheese integer DEFAULT 0,
fh_unavailable boolean
/*
"communityvisibilitystate" : 3,
Expand Down
1 change: 0 additions & 1 deletion worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ var queue = require('./queue');
var buildSets = require('./buildSets');
var utility = require('./utility');
var getData = utility.getData;
var serviceDiscovery = require('./serviceDiscovery');
var getMMStats = require("./getMMStats");
var invokeInterval = utility.invokeInterval;
var numCPUs = require('os').cpus().length;
Expand Down

0 comments on commit 53e4567

Please sign in to comment.